• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems with compiling a class importing from javax.comm

 
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to compile a class with this statement
import javax.comm.*;

But I get the error that the package does not exist.

The comm.jar is sitting in both
c:\java\javax\commapi
c:\java\j2sdk\j2sdk1.4.0\lib

My classpath is
%J2EE_HOME%\lib\j2ee.jar;
C:\java\javax\commapi\comm.jar;
C:\java\javaMail\javamail-1.3\mail.jar;
C:\java\jaf\jaf-1.0.2\activation.jar;
C:\satStarHome\server\lib\sscomm.jar;
C:\java\projects\misc;
C:\java\j2sdk\j2sdk1.4.0\bin;
C:\test


Please can someone help me to compile this silly class!!
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The lazy method that worked for me is:
put often used jars into

directory, without using classpath.
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lazy methods work for me! Why don't people just do this normally? What's the use of the classpath then?
 
Stefan Wagner
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a) Your ext-dir may get filled with lot's of jars, and you may use overview.
b) You might need a version 0.1.17 for application x and 0.2.4 for application y. Having them separated might be more easy.
c) If you get used to it, you start to forget to ship the jars, you depend on.
d) ?
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh, I see. So can you give me any info on how to fix my CLASSPATH so I wouldn't have to put the jar in \ext?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Personally I have given up on setting the environment CLASSPATH and use ANT for anything but the simplest compilation. With ANT you can compile using a classpath set for a particular project with all the right jar files, no matter how many alternate versions are hanging around your system.
Bill
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What exactly is ANT?
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, the comm api presents some issues during run time that are easiest solved by installing it per the directions. Which include putting the jar in the ext dir of your JRE. The care you need to take here is which JRE is beening used when. Some IDEs will install their own Java with their own JRE and not look at the one you may have set in the system.

For just compiling, your classpath looks like it should find this. Is the jar corrupted? Does the variable J2EE_HOME contain spaces? This could corrupt the full classpath. How are you compiling this? Is the compile process using a different classpath than the system setting?
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rachel Swailes:
What exactly is ANT?




"Another Neat Tool" It's a build process centered on XML which invoke Tasks defined in the build XML. Actually very powerful as a Task can do practiaclly anything since they are written in Java. The base taskes in clude JAVAC, RMIC, EXEC, COPY, DELETE, MKDIR etc. there are quite a number of them. Optional tasks distribute with ANT include JSPC, Various tasks to deploy EJBs into several servers. Tasks have been written by others that can easily be reused such as JUNIT which allow automated running of Junit test cases.
You can see a discussion of ANT right on JavaRanch
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Carl Trusiak:
Which include putting the jar in the ext dir of your JRE. The care you need to take here is which JRE is beening used when

Is the jar corrupted? Does the variable J2EE_HOME contain spaces? This could corrupt the full classpath. How are you compiling this? Is the compile process using a different classpath than the system setting?



The jar is the one I have gotten off of the sun website. Everything else looks good with it.
The J2EE thing doesnt have spaces.
I'm compiling it with JCreator but compiling it on the cmd line works fine too.
reply
    Bookmark Topic Watch Topic
  • New Topic