• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Can't find .class file

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using this:
SET JAVA_HOME=C:\jdk1.3.1
SET J2EE_HOME=C:\j2sdkee1.3
SET PATH=%PATH%;%JAVA_HOME%\bin;%J2EE_HOME%\bin
SET CLASSPATH=%JAVA_HOME%\lib\tools.jar;%J2EE_HOME%\lib\j2ee.jar;%J2EE_HOME%\lib\jhall.jar;.
I created a servlet and compiled using:
javac -classpath MyServlet.java
The compile gave no errors and appeared to compile properly; however I cannot find MyServlet.class anywhere. If I compile a non-J2EE class in the same directory, the .class file shows up as it should.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The -classpath option for the java compiler javac is used to specify external jar files for the compiler to look for. I don't know if this is causing your problem, but you can ommit the -classpath option. So just do:
javac myServlet.java
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the problem. There was actually a syntax error in the code. The confusing part is that the compiler never alerted me. The command prompt went to the next line as though the compile were successful. Any ideas why that would happen?
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javac is a bit glitchy when you type exactly what you typed. You provided the -classpath switch, but didn't give it a value. It quietly fails when you do this.

And Gregg: You should *absolutely* always use -classpath when compiling. There have been numerous discussions about this, most of them along the lines of "classpath, why do you hate me so?"

I highly recommend -classpath. It solves many problems. When people say "Just say no to CLASSPATH" they mean the system classpath setting.

By default though, include the dot directory.

javac -classpath . foo.java
 
Darryl Failla
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, I thought I was imagining things.
I have yet to find a clear explanation of what the dot at the end of the classpath is doing. Any directions?
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic