|
Bikle.com web Portfolio: http://VietEnglish.com http://Edgar411.com http://ForumGrouper.com http://hpricot.com
Ajax Demo:
Categories
of
URLs
Plain HTML
(no Ajax here): Categories:
|
javaDOStips.htm 05-06-2002 Bikle ----------------- Java DOS Tips Working with Java command line utilities seems to work better inside a UNIX shell than inside an MS-DOS shell. The problem is, sometimes I cannot steer clear of the MS-DOS shell during my day to day work. I list some .bat files below which help me keep my memory fresh when I'm working inside an MS-DOS shell. A demo script of transforming a .java into a .class using javac.exe: javacDemo.bat Ideas to note: -Comments start with the string "rem" or "REM" -Set a variable using syntax like this: set JAVA_HOME=e:\jdev32\java1.2 -Reference the variable using the % character on BOTH sides of the variable: set CLASSPATH=%JAVA_HOME%/jre/lib/rt.jar -If x.java depends on y.java which depends on x.java, place them both on the javac.exe command line: "%JAVA_HOME%\bin\javac.exe" -classpath "%CLASSPATH%" x.java y.java -Notice that I make use of double quote (") when I want a variable expanded inside of a path and then make that path part of a command. -Take note that the CLASSPATH tokens are separated by semi colons rather than colons (unlike UNIX). DOS demo: set CLASSPATH=\a\path\to\a\x.jar;\another\path\to\somejar.jar UNIX demo: CLASSPATH=/a/path/to/a/x.jar:/another/path/to/somejar.jar Once I get all my .class files created, I can use them to create a .jar file. A demo script: jarDemo.bat Once the .jar file is created, I can move it to a directory where I like to put many of my .jar files: c:\jar. Then, I can place its location in a CLASSPATH variable and use that variable in a Java command line: javaDemo.bat One of the main points I want to make here is that when I work with Java in the MS-DOS command line environment, I make use of scripts instead of working directly in the shell like I do in a UNIX shell. Also, it is important to have access to a decent editor. I'd suggest you steer clear of MS notepad. If you are in a big hurry, download a copy of TEdit from here: http://download.com If you want an editor which will edit just about ANYTHING (even binary files) get a copy of emacs: http://ftp.gnu.org/gnu/windows/emacs/latest/ Emacs comes with a learning curve and an appetite for disk space (about 30mb); it may not be for you. I happen to like emacs so I recommend that you learn it. If you are a command line kind of a person who likes to write scripts rather than deal with life via wizard, I recommend you get a copy of cygwin for your PC. A description from their website http://cygwin.com: Cygwin is a UNIX environment, developed by Red Hat, for Windows. It consists of two parts: A DLL (cygwin1.dll) which acts as a UNIX emulation layer providing substantial UNIX API functionality. A collection of tools, ported from UNIX, which provide UNIX/Linux look and feel. The Cygwin DLL works with all non-beta, non "release candidate", ix86 versions of Windows since Windows 95, with the exception of Windows CE. |
|
|
http://bikle.com |
Built With Rails |
4096 Color Wheel |