27.04.2013 Views

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

330 Java Tips.pdf - FTP Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Miscellaneous I<br />

-9 switch, you might want to create compressed JARs with any ZIP tool like Winzip or<br />

the free Info-ZIP zip command line tool.<br />

The amount of reduction you get totally depends on the nature of your data.<br />

Note that if you use compression in your JAR file, loading goes slower (classes must<br />

be decompressed).<br />

Q: Is there any way to run code after the VM has been instructed to exit?<br />

Answer: In 1.3, you can use Runtime.addShutdownHook(Thread hook)<br />

Q: Where can I find <strong>Java</strong> --> Native code compilers?<br />

Answer: We just published a list of <strong>Java</strong> products that lets you do<br />

<strong>Java</strong> --> Native code compilation:<br />

http://javafaq.nu/java/staff/staff.shtml<br />

I have a directory having class files arranged in package hierarcy. How can I<br />

make the executable of this whole directory?<br />

Any application available for that in Windows NT environment.<br />

Answer: Make a JAR file out of it and add a manifest file that indicates which main()<br />

method of which class must be called.<br />

Double-clicking this JAR file will run your application.<br />

Q: I'm interested in writing a little mp3 player in <strong>Java</strong>...<br />

I'm interested in writing a little mp3 player in java. I have an entirely different app<br />

right now that plays sound (wav files), and I substituted an mp3 file for one of the<br />

waves but it didn't work. Can anyone tell me if java even supports mp3 files?<br />

Answer: Go to the "Products & APIs" section of java.sun.com and look for JMF (<strong>Java</strong><br />

Media Framework). It's a library that also supports reading MP3 files.<br />

Q: Are there any tools out there that will convert a program writen in C to JAVA?<br />

Answer: Yes.<br />

C2J: http://www.novosoft-us.com/NS2B.nsf/w1/C2J<br />

C2J has successfully compiled itself as well as programs such as PGP and YACC.<br />

Obviously YMMV.<br />

Based on C2J is a C++ to <strong>Java</strong> tool: http://sol.pace.edu/~tilevich/c2j.html<br />

-jim<br />

Q: Can we create DLLs in java??? if yes How???<br />

Answer: Unfortunately it is impossible. DLL stands for Dynamic Linking Library and<br />

has definite structure inside. DLL is a part of executable code and helps to make an<br />

application for Windows to be more smaller. And more flexible. It is something like<br />

classes but compiled (<strong>Java</strong> class files are byte codes and JDK compiles them during<br />

the runtime...).<br />

In <strong>Java</strong> it is not possible to make an executable code. But with third party software<br />

Yes!<br />

See native compilers on our site.<br />

But I didn't hear about creating DLLs.<br />

file:///F|/350_t/350_tips/miscellaneous-I.htm (5 of 11) [2002-02-27 21:18:44]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!