I think another ClassPath problem

I have a java application (class) called MainClass in package MP1. I want to use an external class in
it. the class is called kl1.java and here it is.
package pak1;
public class kl1 {
public int k;
I tried to import that class using JBuilder, Netbeans with no success. I don't want to put that class in my MP1 package (because it is not actually one but many classes, and they are all defined to be part of the pak1.something.something packages). If i put them in my MP1 package i will have to change every class to be part of the MP1.pak1.something.something package which obviously i can't do.
So the classes i want to use are located at C:\pak1 and my project is located at C:\myProject. How to use those classes. I added the classes with JBuilder somehow and it recognized them i.e. when i started writing import pak.k... it poped up the autofinish dialog with kl1 class showing. so it found the class. but when i compiled it it said couldn't find class.
the line kl1 k = new kl1(); was an error, it couldn't find kl1.
Please help. Thanks!

in the older versions of NetBeans you had to tell your project which folders to include; you used to be able to do it with a right click on resources and browse, but i've not looked how to do the same thing in the new version yet.

Similar Messages

  • Not another classpath problem...

    I'm trying to use the TableExample demo from jdk1.3.1. I'm using cloudscape as the database for this from the j2sdkee1.3.1.
    The database starts no problem (rmi mode).
    So I run the example and provide the database driver in the popup window, only to get the exception:
    java.lang.ClassNotFoundException: COM.cloudscape.core.RmiJdbcDriver
    So it can't find the class at all. So to try things out I attempt to run this class (knowing that it won't have a main method, but just to see if it is found):
    C:\jdk1.3.1\demo\jfc\TableExample>java -classpath %CLASSPATH% COM.cloudscape.core.RmiJdbcDriver
    Exception in thread "main" java.lang.NoSuchMethodError: main
    So my system can find the class but not the main method in it. So why can't the demo application also find this class?
    I must have read lots of tracks on classpath and though I knew what I was doing (adding all paths/jars to the classpath environment variable). Obviously I don't!
    ps Both running the application and trying to run the class were from the same shell using the same value of classpath.

    I work under NT 4.0 and am new to java. I have this batch file which I run in a command window before starting to work:
    PATH=.;D:\Java\jdk1.3.1_02\bin;D:\Java\jdk1.3.1_02\jre\bin;C:\WINNT\system32;C:\WINNT;
    SET CLASSPATH=D:\Java\jdk1.3.1_02\jre\lib;.
    Notice the ".", that tells Windows NT to look in the current directory.
    I do it this way because I have other development tools installed which also use Java and I did not want to interfere with them as I was learning.
    Good luck
    Bill

  • Another classpath problem

    im using ubuntu. i wrote a program called FlickrScreensaver in eclipse and got a .class file.
    now when i navigate to the .class file's directory and type java FlickrScreensaver
    i get this
    Exception in thread "main" java.lang.NoClassDefFoundError: FlickrScreensaver (wrong name: screensaver/FlickrScreensaver)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    same if i try this: java -classpath . FlickrScreensaver
    any ideas?
    Thanks!

    Because your class isn't in the default package. It's in a package named screensaver.
    So you would go into the directory below screensaver and run
    java screensaver.FlickrScreensaver

  • Another simple classpath problem question

    Hi All
    Yes I know, there are a lots of questions about this matter, but I couldn't found a solution to my problem.
    I have a simple program:
    public class prueba {
            public static void main(String[] args) {
                    System.out.println("Ahi va...");
    }placed in /tmp/javier/prueba.java
    After compiled, I've tried to run it from / and then problems started:
    cd /
    java /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    I said, ok...it could be a classpath problem...then:
    java -cp /tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba
    Damn, another try...
    java -cp .:/tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Jesus Christ....may be the last slash....
    java -cp .:/tmp/javier /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Oh...no.... may be classpath to java classes..
    java -cp .:/usr/java/j2sdk1.4.2_01/lib/jre/:/tmp/javier/ /tmp/javier/prueba
    Exception in thread "main" java.lang.NoClassDefFoundError: /tmp/javier/prueba (wrong name: prueba)
    Well, I don't know why this error happens....
    Please, could somebody help me !!!
    Thanks in advance...
    <jl>

    It's not too early to start following the Sun coding
    conventions for Java:
    http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.
    tmlHi
    thanks for your reply.
    Yes, I agree. I use conventions with my programs. But my real problem was with a real application and then I did quickly this simple code to help others to understand the problem and give a fast reply...
    Let me know if that works. (It was fine on my
    machine.) - MODYes it works fine, thanks.... and Damn...Murphys law again, the only option I didn't tried is the solution to my problem... :)
    Thanks again...

  • Classpath problem

    i am here stuck..
    my dir structure is
    c:\my\xxx\yyy\zzz
    i have a code ...
    package xxx.yyy.zzz;
    class A
    // some code
    }i have compiled sucessfully and put the clsss file into c:\my\xxx\yyy\zzz folder.
    now i want to import it in another class
    like...
    package xxx.yyy; // note this
    import xxx.yyy.zzz.*; // note this
    class B
    // some code
    // creating instance of class A here
    }question is how do i compile and run it ?
    i am at c:\my---> what should be the command to compile and run the above code?
    plz give me the explicit command so that i can test and verify . i have given the dir structure.
    i have tried several ways but got class not found exception and errors . i know its a classpath problem but i could not figure out what should i type at the c:\my prompt.
    can u give exact command to run and compile the above code in steps ?
    thanx

    question is how do i compile and run it ?You don't with that code. You've defined class A to have "package visibility," meaning it can't be used from outside its package. You should declare it with public visibility instead, like "public class A {...".
    Once you change that, use these commands to compile and run:c:\my\>javac xxx/yyy/zzz/A.java
    c:\my\>javac xxx/yyy/B.java
    c:\my\>java xxx.yyy.B

  • Classpath problems in EAR packaging?

    I try to access an EJB from a JSP. The JSP resides in web.war and the bean is in ejb.jar, and both of these are packaged together in an ear.
    I get a compile error when I try opening a JSP. I've had this problem in all my attempts to use my bean classes from JSP.
    My browser reports that the compiler cannot find the beans package. I have servlets within the war-file that are able to find the beans package, but the JSPs aren't.
    My ear-file contains 3 files
    ejb.jar
    web.war
    META-INF\MANIFEST.MF
    The manifest classpath points to ejb.jar and web.war
    My guess is that this has something to do with the way this is deployed by GlassFish.
    The application is deployed in the
    domains\mydomain\applications\j2ee-apps\myear\
    This directory contains the expanded files:
    ejb_jar\
    web_war\
    META-INF
    So the Java classes under web_war\ are able to see the Java classes under ejb_jar\ (i.e. my servlets)
    However; when GlassFish creates Java files from the JSPs and then tries to compile them, these files are placed under
    domains\mydomain\generated\jsp\j2ee-apps\myear\web_war\org\apache\jsp\jsp
    This might be correct for all I know, but apparently the compiler is unable to find the Java classes located under the mydomain\applications\.. directory when compiling classes located under the mydomain\generated\.. directory. There are no other files from my ear anywhere in the "generated" directory.
    So to me this seems to be some kind of classpath problem, as the compiler cannot find the needed files.
    Does this make any sense to anyone?
    PS
    In my ear, the JSPs are placed in the web.war. The war file looks like this:
    jsp\
       myjsp.jsp
    META-INF
       MANIFEST.MF
    WEB-INF
       web.xml
       lib\
          mylib.jarThanks
    \\Marius

    Marius,
    If you want communicate the bean you have to do following things.
    . Create a factory for the correct protocol
    . Obtain a Home
    . Use the Home to create stubs to the remote object
    So you want to call the Home and Remote interfaces to access the bean. When you run the client program, it will create the remote object that time it has to search the Home and Remote interfaces. So you have included those files for references in following location
    WEB-INF/classes
         -- <Home Interface File Name>.class
         -- <Remote Interface File Name>.class
    Or
    WEB-INF/lib
         -- <Bean Jar file name>.jar
    I think you will understand.
    -Mani

  • Help classpath problem j2sdk1.4.2_04

    help classpath problem j2sdk1.4.2_04
    how can i run the java program with specify the file location
    such as :
    -----this one is fine ok and return HelloWorld.class-----
    [root@localhost root]javac /serverData/studentAC/s001/HelloWorld.java
    -----but this one cause exception-----
    [root@localhost root]java /serverData/studentAC/s001/HelloWorld
    -----result-----
    Exception in thred "main" java.lang.NoClassDefFoundError: /serverData/studentAC/s001/HelloWorld
    [root@localhost root]
    I have tried a lot of classpath setting:
    I just want to compile and run the java program without specify the classpath only !! please help !!! and give suggest !! if you have this exp!!
    # ---1
    #PATH=/usr/java/j2sdk1.4.2_04/bin:$PATH:$HOME/bin:./
    #export PATH
    #export JAVA_HOME=/usr/java/j2sdk1.4.2_04/
    #export #CLASSPATH=/usr/java/j2sdk1.4.2_04/lib/tools.jar:/usr/java/j2sdk1.4.2_04/jre/lib/rt.jar:./
    # ---2
    #set java environment
    # Java Setup Section START
    export JAVA_HOME="/usr/java/j2sdk1.4.2_04"
    export JRE="$JAVA_HOME/jre"
    export CLASSPATH="$JAVA_HOME/lib:$JRE/lib:$JAVA_HOME/lib/tools.jar:."
    export PATH="$PATH:$JAVA_HOME/bin"
    # Java Setup Section END
    # ---3
    #PATH=$PATH:/usr/java/j2sdk1.4.2_04/bin
    #JAVA_HOME=/usr/java/j2sdk1.4.2_04/
    #export PATH
    # ---4
    # Java Setup Section START
    #JAVA_HOME=/usr/java/j2sdk1.4.2_04
    #export JAVA_HOME
    #CLASSPATH=$CLASSPATH:/usr/java/j2sdk1.4.2_04/lib:/usr/java/j2sdk1.4.2_04/jre/lib:./
    #export CLASSPATH
    #PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
    #export PATH
    # Java Setup Section END
    # ---5
    #export PATH=$PATH:/usr/java/j2sdk1.4.2_04/bin
    #export JAVA_HOME=/usr/java/j2sdk1.4.2_04
    #export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib:$CLASSPATH:.
    # ---6
    #====================================================
    #export JAVA_HOME=/usr/java/j2sdk1.4.2_04
    #export PATH=$JAVA_HOME/bin:$PATH
    #export CLASSPATH=/usr/java/j2sdk1.4.2_04/lib:$CLASSPATH
    #====================================================

    I think this will work. java -classpath /serverData/studentAC/s001 HelloWorld

  • Classpath Problem (Using JSAPI)

    Hi,
    I using IBM Via Voice as a the implementation of the JSAPI on my system. I've downloaded the speech for java pack from IBM Alphaworks and put it in the directory of
    c:\ibmjs
    This gives you access to the speech packages for utilisation in your programs so I should be able to import javax.speech in my programs. However the system doesn't see these classes.
    Heres my Autoexec...
    path=%path%;c:\jdk1.3.1_01\bin;c:\ibmjs\lib;
    CLASSPATH=%CLASSPATH%;c:\ibmjs\lib\ibmjs.jar;
    I presume the whole thing is just a classpath problem, does anybody have any idea from the above paths where I am going wrong?

    i guess you have to put some of ibm's dll files coming with speech for java in the path (not classpath). it's not sufficient to have the directories in the path.
    anyway, there come's an installation manual with speech for java which explaines all that.

  • Fragment Bundle Classpath problems

    Does anyone have any tips for solving classpath problems in fragment bundles? I'm getting a no-class-def that I can't explain.
    I've used maven to create a fragment, hosted by com.day.crx.sling.server, to create a custom login. It needs to call a web service, so I've included httpclient-4.2.3.jar. I can see this jar listed on the deployed fragment's Bundle-ClassPath, via the osgi>bundle console. When I inspect the bundle that maven created, I can find this jar contained in the bundle jar, in the directory specified in the Bundle-ClassPath. I even oppened the httpclient jar to ensure that the offending class (org/apache/http/client/HttpClient) is there.
    This is the first fragment that I've tried to build. Is there something I don't know about how they load classes?
    Does anyone have any tips or tricks on solving osgi classpath problems? I read that felix has some tools, but I haven't found any documentation about them.

    I'm still not sure why the classes didn't load, but I have a solution to my problem - don't try to include the jars in the fragment bundle. I tracked down osgi-ready versions of the libraries that I needed and and installed them.

  • Again classpath problem

    again classpath problem.... i have tried to solve it in many ways but all failed. here is one
    instance of my effort which did not give me success.
    i have a FOLDER > c:/com/abc/def/ijk
    and files......
    MyClass.java
    ==============
    package com.abc.def.ijk
    class MyClass
    // blah
    // blah
    }c:\com\abc\def\ijk>javac MyClass.java ===>compiled fine and created a class file.
    and also one more file.....
    OneMoreClass.java
    =================
    import com.abc.def.ijk.MyClass
    class OneMoreClass
    // blah
    // blah
    }c:\com\abc\def\ijk>javac OneMoreClass.java ===> Error!!! package com.abc.def.ijk does not exist !!!!
    how can i solve it ?

    yea, this works....eariler i also usued to do this
    way. but this time i forgot.
    by the way, why individually it did not work !!!.Because you were in the package directory itself, and the classpath was set to the cwd, so java was looking for package directories at this level.
    and also when i specify directly by
    c:\com\abc\def\ijk
    javac  -classpath c:\com\abc\def\ijk\MyClass
    OneMoreClass.java ...it does not work!!.
    STRANGE! why ?Because by stating the package directory as classpath, you do the same as explained above. Stay out of package directories, stay one level above them, don't regard them as common directories. When declaring classpaths, don't mention package directories but the directories that contain them.

  • JDBC and Classpath problems on OpenVMS

    Hello,
    I'm working on an OpenVMS server and I got a simpler Java application that needs to establish a connection to an Oracle database, the application works perfectly well on Windows but when I moved to OpenVMS I got some problems with the oracle driver.
    I believe I�m using the correct driver, I already checked on the oracle site according to my java version (1.4.2) and my database version (oracle 9i 9.2.0.7.0)
    This is the error:
    $java -jar miss.jar "DnBProcess"
    About to start loading parameters for the MISS Proxy.
    Successfully load parameters for the MISS Proxy.
    About to load interface settings for DnBProcess
    Settings for DnBProcess succesffully loaded.
    About to load interface DnBProcess
    About to start loading parameters for DnB Interface.
    Successfully load parameters for DnB Interface.
    Interface DnBProcess succesffully loaded.
    About to execute interface DnBProcess
    Connecting to the database...
    java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
    at miss.DnBProcess.ExecuteQueryToFile(DnBProcess.java:85)
    at miss.DnBProcess.Execute(DnBProcess.java:178)
    at miss.Proxy.ExecuteInterface(Proxy.java:160)
    at miss.Proxy.main(Proxy.java:207)
    I know is a classpath problem, and my classpath on VMS looks like this:
    define JAVA$CLASSPATH .,SYS$COMMON:[JAVA$142.LIB]TOOLS.JAR,SYS$COMMON:[JAVA$142.LIB]DT.JAR,SYS$COMMON:[JAVA$142.JRE.LIB]RT.JAR, USER1:[MONTEALEGRE.TEST.LIBS]OJDBC14.JAR,USER1:[MONTEALEGRE.TEST.MISS.LIBS]OJDBC14.JAR,[]
    As you can see I added the �ojdbc14.jar� in different folders but my application seems not to find it.
    Does anyone know how to set the classpath properly on VMS? Or maybe give me some tips that could lead me to find a solution to this problem.
    Thanks.
    Ileana.

    I would try googling for OpenVMS classpath. Unfortunatley the first result is this thread but there are a bunch of resources from IBM and HP listed and maybe they can help you.

  • My iPhone 6 panoramic camera does not work properly: the arrow does not turn when i turn my phone. Furthermore sonetti da my Keyboard does not turn as well. What do you think si the problem?

    My iPhone 6 panoramic camera does not work properly: the arrow does not turn when i turn my phone. Furthermore sonetti da my Keyboard does not turn as well. What do you think si the problem?

    Furthermore my keyboard does not turn sometimes as well

  • I have 2 Adobe IDs and I think its causing problems. How do I delete the redundant one?

    I have 2 Adobe IDs and I think its causing problems. How do I delete the redundant one?

    I don't think you can... you will have to have an employee delete/merge for you
    Adobe contact information - http://helpx.adobe.com/contact.html may help
    or
    Change Account https://forums.adobe.com/thread/1465499 may help
    -ID support http://helpx.adobe.com/x-productkb/global/service-c1.html

  • YAPP (Yet Another Printing Problem)

    I've found another printing problem - this time with colour printing.
    To my
    surprise, Forte (3.0.E.0) can print in colour (at least on a HP 690C,
    using
    NT drivers for the 660C, the printer being connected to a Win95
    machine).
    I can print OK with from my NT develpoment machine in colour, but when
    running
    the same app from the Win95 client with the printer attached locally the
    coloured text disappears. Has anyone else come across this problem?
    Is this another of the 'Printing works fine as long as it happens
    non-locally?'
    features?
    Thanks
    Jamie Anstice
    Programmer/Analyst, University of Canterbury
    New Zealand

    I can print OK with from my NT develpoment machine in colour, but when
    running
    the same app from the Win95 client with the printer attached locally the
    coloured text disappears. Has anyone else come across this problem?Hi Jamie,
    I wonder if this is related to the printing feature I discovered
    where things I print from Forte have a strong tendency to come out in
    the same colours as my windows desktop, which is
    typically yellow-on-black.
    - Ed
    ================================================================================
    Eduard E Havelaar, Information Services Section, University of Canterbury
    email: [email protected]
    phone: +64-3-366 7001 extn 8910
    fax: +64-3-364 2999
    snailmail: Private Bag 4800, Christchurch, New Zealand

  • What do you think is the problem of my macbook, few days ago, the fan is not working its 000rpm, early this morning, it is working already. what suppose is the problem?

    what do you think is the problem of my macbook, few days ago, the fan is not working its 000rpm, early this morning, it is working already.

    What did the prompt look like? Did it look like the image here? http://support.apple.com/kb/TS3742

Maybe you are looking for

  • Down payment clearing

    Hi:    I have 4 open items in ledger,2 down payments and 2 invoices..When I am clearing them in F-44 I am receiving an error Message no. AAPO219 Asset 1000 1000000-0: down payment to be cleared not unique Please help me sort out this issue.

  • My ipod shuffle isn't showing up on itunes or my computer

    I went to go update my ipod but when i plugged my ipod shuffle 2nd gen, nothing came up on itunes or my desktop. The light on it is repeatedly flashing orange though when plugged into the computer. But when i plug it into the wall, it flashes green,

  • Address Book will not print

    I am new to MAC. I have spent the last month entering 1037 contacts into my address book. Now I cannot print it. The software itself does not respond. I have had to force quit it everytime. I tried to do smaller segments, but I actually cannot even p

  • No delivery

    I created an SO and entered a BOM header material which exploded.  But when it comes to delivery, it shows 0 quantity in the quantity field and cannot be delivered even if I change the quantity in that field, it goes back to 0. I have checked MMBE an

  • Need to change as one insert stmt

    Hi, I'm using below two insert statements in side the procedure.can i re write as a one insert.pls help         INSERT INTO REP_ITEM_STAT_OPN (         REP_ID, ITEM_ID, TOT_STUD_BY_ITEM, TOT_TIME_BY_ITEM, MIN_TIME_BY_ITEM,MAX_TIME_BY_ITEM)         SE