What's wrong with this command?

Nothing in Java is easy except for the actual programming. I swear this is so complicated. I just want my single applet to work on a machine with java re 1.4. I type in this command to get the job done:

javac -target 1.4 -bootclasspath"C:\j2sdk1.4.2_15\lib" -extdirs"" Counter.java

which is an identical copy of Java's example found here: http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/javac.html

but I keep getting this error:

javac: target release 1.4 conflicts withdefault source release 1.5

Which doesn't make sense because I am using 1.6u2

What did I do wrong?

Why don't they have a program that does this ancient command line grunt work for you?

[795 byte] By [Galm_1a] at [2007-11-27 10:32:26]
# 1

Set the source flag, too, if you're compiling to 1.4.

"-source 1.4"

Alternately, you can set the bootclasspath and extdir flags. See the documentation here:

http://java.sun.com/javase/6/docs/technotes/tools/windows/javac.html

~

yawmarka at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 2

Well that may have worked but:

Fatal Error: Unable to find package java.lang in classpath or bootclasspath

I typed the right directory where I just installed 1.4. Where would java.lang be located in it?

Galm_1a at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 3

> -bootclasspath "C:\j2sdk1.4.2_15\lib"

You need to specify the full path to the rt.jar. Example:

-bootclasspath c:/j2sdk1.4.2_15/lib/rt.jar

~

yawmarka at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 4

Alternately, you can install a proper free IDE such as Eclipse WTP (search for Eclipse WTP) to develop java, and not do command line programming. I dont think anyone programms via the command line anymore.

George123a at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 5

> I dont think anyone programms via the command line anymore.

Knowing how to use command-line tools will greatly enhance the OP's knowledge of how to troubleshoot issues like this, including problems like this that turn up when using IDEs.

~

yawmarka at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 6

I don't have an rt.jar in the lib folder. I only have tools.jar, dt.jar, and htmlconverter.jar. None of which work.

Galm_1a at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 7

> I don't have an rt.jar in the lib folder. I only

> have tools.jar, dt.jar, and htmlconverter.jar. None

> of which work.

Sorry -> "c:/j2sdk1.4.2_15/jre/lib/rt.jar" "RT" stands for "real-time", and it contains the java.lang.* classes you'll need.

You could have searched for rt.jar under the 1.4 directory, you know... ;o)

~

yawmarka at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 8

I thought jre was runtime and was only used when running programs...

...but hey what do I know. Thank you yawmark!

Galm_1a at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 9

> I thought jre was runtime and was only used when

> running programs...

It is, but those are the bootstrap classes you'll need to compile against when you want to run your application on that version.

> ...but hey what do I know. Thank you yawmark!

You're very welcome; glad you got it working, and I'm sorry again for any frustration caused by the incorrect file path I posted earlier.

Cheers!

~

yawmarka at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...
# 10

No frustration. I am just tired of all these problems I get. I am lucky there is this forum.

Galm_1a at 2007-7-28 18:16:43 > top of Java-index,Java Essentials,New To Java...