I don't know if this will help at all...but sometime ago...I installed a printer driver for HP LaserJet 1010 on one of my PCs....and some how, it interfered with Sun JDK installation on that machine.
I think the driver used a custom implementation of TomCat server, which caused the problems.
It took me ages to figure out what went wrong...and ended up re-installing JDK and everything worked fine thereafter.
I would try and re-install Sun JDK...in case you've installed a software application that implements its own JVM which might be causing all the problems.
Thats what I was thinking with the versions....Many programs install their own JDK, but I don't see any in the path variable. Usually they put themselves in your windows path, which really throws things off.(Pointing at you Sybase!)
Here we go again. I reinstalled both JRE and JDK into folder C:\Java and changed the path to point the new installation, and still not working. This is indeed a very strange case. I have a feeling it has something to with Vista, but can not be sure. Test results below, everything looks like normal.
C:\Java\jdk1.6.0_07\bin>javac
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are used
-classpath <path> Specify where to find user class files and annotation processors
-cp <path> Specify where to find user class files and annotation processors
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-proc:{none,only} Control whether annotation processing and/or compilation is done.
-processor <class1>[,<class2>,<class3>...]Names of the annotation processors to run; bypasses default discovery process
-processorpath <path> Specify where to find annotation processors
-d <directory> Specify where to place generated class files
-s <directory> Specify where to place generated source files
-implicit:{none,class} Specify whether or not to generate class files for implicitly referenced files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-Akey[=value] Options to pass to annotation processors
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
C:\>java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
Oh, I just noticed the second page of this thread Maybe it indeed is some other program that is messing the Java installation, but that will definitely take ages to find it out as I have dozens of programs installed. Maybe I just have to stick with IDE's until that. But if you get an idea what might be the problem or if you notice something wrong with my settings, please let me know...
The javac command gave you the usage instructions just as it should.
Not really! It works as it should only in Java installation directory. When I try to use javac in ANY other directory, I get an error message "javac is not recognized as an internal or external command etc". So the original problem still exists. It was just a test suggested by ess in the previous message to find out whether or not javac works at all...
Not sure if this is going to help you at all...but when I went through the beta testing of Windows Vista before it was released, I experienced the same problems that you've described above...where my JDK installation didn't work even when the path variable was set correctly.
Not that I am implying that you don't have a legitimate copy...but wondered if you need to update Vista and apply all the latest patches such as Windows Vista SP1 etc.
Furthermore, you need to ensure that you download and install the correct JDK for your system. In other words, if your system is x64 based, you should download and install the JDK x64 release and not the i586 release.
I have a 32-bit system and the correct JDK is installed. I also have SP1 and all the latest updates installed, as I have Vista's autoupdate on. Like I mentioned earlier, in my XP machine everything works just fine, like in the previous message's screenshot. Like also mentioned before, this seems to be a very strange case, and only explanation I can figure out, is that some other program is messing up the JDK installation, since all the basic settings seems to be in order.
I have followed the above advice, but I can not get past
javac Hello.java
Code:
C:\Users\moporho>javac Hello.java
javac: file not found: Hello.java
Usage: javac <options> <source files>
use -help for a list of possible options
C:\Users\moporho>java Hello.java
Exception in thread "main" java.lang.NoClassDefFoundError: Hello/java
Caused by: java.lang.ClassNotFoundException: Hello.java
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Here is set
Code:
Microsoft Windows [Version 6.0.6001]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.
C:\Users\moporho>java -version
java version "1.6.0_07"
Java(TM) SE Runtime Environment (build 1.6.0_07-b06)
Java HotSpot(TM) Client VM (build 10.0-b23, mixed mode, sharing)
c:\>set
ALLUSERSPROFILE=C:\ProgramData
APPDATA=C:\Users\moporho\AppData\Roaming
CLASSPATH=.;
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=MOPORHO-PC
ComSpec=C:\Windows\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\moporho
JAVA_HOME=C:\jdk1.6.0_07\bin;
LOCALAPPDATA=C:\Users\moporho\AppData\Local
LOGONSERVER=\\MOPORHO-PC
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\Windows\system32;C:\Win
dows;C:\Windows\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\ATI T
echnologies\ATI.ACE\Core-Static;C:\Program Files\Common Files\Roxio Shared\DLLSh
ared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program File
s\QuickTime\QTSystem\;C:\jdk1.6.0_07\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 15 Stepping 11, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=0f0b
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
PROMPT=$P$G
PUBLIC=C:\Users\Public
QTJAVA=C:\Program Files\Java\jre1.6.0\lib\ext\QTJava.zip
RoxioCentral=C:\Program Files\Common Files\Roxio Shared\10.0\Roxio Central36\
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\Windows
TEMP=C:\Users\moporho\AppData\Local\Temp
TMP=C:\Users\moporho\AppData\Local\Temp
USERDOMAIN=moporho-PC
USERNAME=moporho
USERPROFILE=C:\Users\moporho
VS80COMNTOOLS=C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\
windir=C:\Windows
Just to say thanks. Had a simulator ok on XP that failed on Vista.
OK now
Quote:
Originally Posted by ess
Please follow these steps...
1- Right Click on My Computer on your desktop and click on Properties
2- Computer Properties Window will open....Click on Advanced System Settings
3- Click ok when the stupid administrator window appears (Personally I have disabled them...as I find them annoying and pointless)
4- Click on Environment Variables
5- Under the Systems Variables, click the NEW button to create a new Variable
6- Enter the following inside the dialog
Variable Name: JAVA_HOME
Variable Value: FOLDER_CONTAINING_JAVA_INSTALLATION for example C:\Program Files\Java\jdk1.6.0_02
7- Inside the Systems Variables, locate the Path entry. Select it...then click on the edit button
8- At the end of the PATH, enter a semi column if there is NOT one there already
9- At the end of the PATH variable, enter %JAVA_HOME%\bin;
Click on Apply and ok buttons to close all opened dialogs
Start a new (if you have one opened already...it won't work) prompt or MS Dos command prompt and type the following
Code:
java -version
You should see details of the installed version of Java etc. once you hit the RETURN key
Within the command prompt, type the following
Code:
notepad Hello.java
Paste the following inside it
Code:
public class Hello {
public static void main(String [] args) {
System.out.println("Hello World ;)");
}
}