Results 1 to 2 of 2
- 02-23-2010, 01:06 AM #1Member
- Join Date
- Jan 2009
- Rep Power
System ClassPath and compiler question
So my system is apparently using an extremely old version of java, something like 1.3.1 or some sort. I have a few questions.
1. I am using Windows XP and would like to know how the command prompt knows that when I type java and javac where to go to find those applications. I understand that the answer is most likely going to be in System ---> Environmental Variables.
2. Assuming that I do NOT change the Environmental Variable, when I java <class name> a file, how can I appropriately tell it to use all the information in C:/Program Files/Java/jre6 (most updated java).
I believe the answer is by using -classpath <above url here>
My problem is that when I use Eclipse on my machine to create applications Eclipse does fine compiling and running the application. However, when I try to compile and run them on my command prompt on my system I get errors such as method not found. So, I am trying to figure out all my alternatives to fixing the problem. This problem will be a wide problem on multiple machines that will use the classfile, so I was hoping I could create a bat or cmd file that would set the correct classpath.
I would appreciate examples if anyone can.
I've tried doing the following and it failed:
java -classpath "C:\Program Files\Java\jre6\bin\*.jar" className
The above was my attempt to say, use all of the new source/code from jre6. However, it is not working.
Thanks in advance.
- 02-23-2010, 03:45 AM #2
- Join Date
- Jul 2007
- Colombo, Sri Lanka
- Blog Entries
- Rep Power
First of all why you are still working on such a old version, you've misses lots of new features.
To use all the java functionality you must set the class path first of all. You can do it in many ways, either in permanent or temporary way.
First way is to set the path in environment variables in your system. This is really good, you need to worry next time once you set the path.
If you are keen with autoexec.bat system file you can set the classpath is there too. But it's bit risky if you don't know exactly how to do that. I use this setup in my PC for command prompt testings and stuff. On IDEs we can easily link the installation path. But I'm not going to give any advice on this.
The other way is bit mess, temporary way. In each time you close and open the command prompt need to do that. Change the command prompt working path to your source file (*.java) included folder. Then type the following command, assume that your Java installation in C:\Prgrame Files\Java\JDK1.6\
Hope it's helpful to you.
- By ŖàΫ ỏƒ Ңόρę in forum New To JavaReplies: 5Last Post: 01-18-2010, 08:46 PM
- By SamuelM in forum New To JavaReplies: 2Last Post: 12-13-2009, 04:06 PM
- By kishan in forum Advanced JavaReplies: 5Last Post: 12-11-2009, 08:24 AM
- By suvojit168 in forum New To JavaReplies: 3Last Post: 07-26-2009, 04:01 AM
- By gamilah in forum New To JavaReplies: 4Last Post: 11-04-2008, 01:32 AM