Running a java program outside eclipse...!

Hi guys...!
I wrote a java program that uses different classes. The program deals with xml documents and creates a new xml document. The problem is, the program works fine in eclipse, but when I run through the command line in windows, it complains that it can't see the different classes that I created. Here is one of the error messages:
Test.java:44:cannont find symbol
symbol : class Circuit
location : class src.Test
Circuit cir = new Circuit ();
Note: Test.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details
Does anyone know how to resolve this...?
Any help from you guys will be very appreciated.
Thanks..

I think the problem is probably something like this:
You have a path thus:
C:\blahblahblah\With a subdirectory thus:
C:\blahblahblah\srcIn which you have declared classes thus:
package src;
public class Foo {
}And you have then used a classpath something like the
following:
javac -classpath C:\blahblahblah\src Foo.javaThis is incorrect. Your classpath needs to point to
the root of the package hierarchy. If it's like the
above, it will look in C:\blahblahblah\src for a
package src, which results in a path like
C:\blahblahblah\src\src which does not exist.
You should set it to:
C:\blahblahblah\Where that is the root from which your packages
stem.
Dave.Thanks Dave. It works man. I really appreciate your help.

Similar Messages

  • Running a java program with eclipse

    Hi,
    I'm trying to run this java program(below) in eclipse..when i go to the 'run' icon inorder to choose the option 'run as' then 'java application' , i have 'none applicable' as the only option available. is it possibly because the program uses threads?
    could someone using eclipse please try to execute this program and let me know if you succeed and how exactly you do it.
    package reseaux;
    import java.io.*;
    import java.net.*;
    import java.util.*;
         public class LeServeur extends Thread{
         Socket socket;
         BufferedReader in;
         PrintWriter out;
         Vector FlowList=new Vector(10);
         public LeServeur(Socket socket)throws IOException{
              this.socket=socket;
              in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              out= new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
         public void run(){
              String s;
              synchronized(FlowList){
                   FlowList.addElement(this);
              try{
                   while(!(s = in.readLine()).equalsIgnoreCase("/quit")){
                        for(int i=0;i<FlowList.size();i++){
                             synchronized(FlowList){
                                  LeServeur monServeur=(LeServeur)FlowList.elementAt(i);
                                  monServeur.out.println(s + "\r");
                                  monServeur.out.flush();
              catch(IOException e){
                   e.printStackTrace();
         finally {
         try {
              in.close();
              out.close();
              socket.close();
         } catch(IOException ioe) {
         } finally {
              synchronized(FlowList) {
              FlowList.removeElement(this);
    thanks

    thanks...
    Infact, i wanted to run the main program called 'Serveur' but it uses 'LeServeur'( the code i sent before') and apparently it gives me an error msg that it doesnot recognise the 'LeServeur'...that's why i was thinking that i should probably first compile the 'LeServeur' so that it can be recognised in the 'Serveur' program.
    here is the 'Serveur' code that uses an instantiation of the LeServeur...
    package reseaux;
    import java.net.*;
    import java.io.*;
    public class Serveur {
              public int port;
              public ServerSocket skt;
              public Socket socket;
         public static void main(String[] args) {
              int port=8975;
              ServerSocket skt=null;
              Socket socket=null;
              try{
                   if(args.length>0)
                        port=Integer.parseInt(args[0]);
              catch(NumberFormatException n){
                   System.out.println("This port is used uniquely for listening");
                   System.exit(0);
              try{
                   skt= new ServerSocket(port);
              while (true){
                   socket =skt.accept();
                   LeServeur flow=new LeServeur();
                   flow.start();
         catch(IOException e){
              e.printStackTrace();
         finally{
              try{
                   skt.close();
              catch(IOException e){
                   e.printStackTrace();
    do you know have any idea why it doesnt recognise the 'LeServeur'?
    ps:they're in the same package
    thanks

  • I am getting an error when I run parameterized java program in Eclipse 3.1

    When I tried to compile an example, java app, I this error.
    I checked, the jre it is using is 1.5.
    Could any one you suggest how to resolve this and why this problem?
    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
         The type ArrayList is not generic; it cannot be parameterized with arguments <String>
         Syntax error, parameterized types are only available if source level is 5.0
         The type ArrayList is not generic; it cannot be parameterized with arguments <String>
         Syntax error, parameterized types are only available if source level is 5.0
         Type mismatch: cannot convert from int to Integer
         Incompatible operand types Integer and int
    Code:
    http://www.anyexample.com/programming/java/java_arraylist_example.xml
         at Ex01.main(Ex01.java:13)
    Edited by: xmlcrazy on Aug 23, 2009 6:59 PM

    I got it. It is under windows/preference/java/compiler/compatibility. This fixes the problem.

  • How to run the package programs in eclipse ?

    hi all,
    how to run the package programs in eclipse ?
    plz clarify...
    regards
    balakrishna.m

    package source code is
    package package1;
    public class ClassaA
              public void displayA()
                   System.out.println("class A");
         }java source code is import package1.ClassA;
         class Packagetest1
              public static void main(String args[])
                   ClassA objectA = new ClassA();
                   objectA.displayA();
         }if i write the notepad means its executing successfully..
    but in eclips is not working..
    plz help me..

  • Run a Java Program

    Hi,
    I created a java program using eclipse.. How can I package it and run the program in windows or Unix?
    Thanks

    Right click the project in the Package Explorer. In the popup menu go Run as->Run Configuration. Click the new configuration button. In the Name box pick a name for your configuration. Make sure the right project is shown in the project field. If not click the browse button and select the right project. Make sure the right main class is listed in the main class field. If not click the browse button and select the correct class. Click apply. Click close. In the popup menu click Export. Double click the Java folder so it drops down. Double click Runnable JAR file. In the Launch Configuration drop down box make sure the right project and main class is shown in this form: Configuration name-main class name. Click the browse button to set the location you are saving the Jar file to. Click finish. Now find the JAR file and double click it to start the program.

  • Error message when try to run copied java program

    Hi Java Guru,
    Can somebody help me with this issue ?
    I was copy my java source from java_ulangan2 to java_ulangan20, when i tried to run the java program, i get an error message.
    Below is the error message:
    05/01/2010 1:02:42 PM /userOut/deploy (com.sap.ide.eclipse.sdm.threading.DeployThreadManager) [Thread[Deploy Thread,5,main]] ERROR:
    [003]Deployment aborted
    Settings
    SDM host : wfmdev
    SDM port : 50018
    URL to deploy : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Result
    => deployment aborted : file:/d:/DOCUME1/GunawanJ/LOCALS1/Temp/temp7843042886291622098Java_ulangan20.ear
    Aborted: development component 'Java_ulangan20'/'local'/'LOKAL'/'0.2010.01.05.13.02.32'/'0':Caught exception during application deployment from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Cannot deploy application local/Java_ulangan20.. Reason: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine?; nested exception is:      com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to deploy application local/Java_ulangan20. Check causing exception for details (trace file). Hint: Are all referenced components deployed and available on the engine? (message ID: com.sap.sdm.serverext.servertype.inqmy.extern.EngineApplOnlineDeployerImpl.performAction(DeploymentActionTypes).REMEXC)
    Deployment exception : The deployment of at least one item aborted
    I really appreciate any kind of help.
    Thanks,
    JGN

    Hi John.
    In past i have faced same problem for the same task. Take help of the Basis team provide tham .ear file name and ask then to un-deploy the file from the server cluster.
    After this deploy your application again.
    Hope this may help you.....:)
    Deepak!!!

  • Error while running a Java Program

    Can anyone help me,
    I am getting the following error while running a Java program, Below is the exception thrown, please help.
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RESummer1.run(RESummer1.java:505)
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RECollectCont.run(RECollectCont.java:304)

    Ok, let's see. Write the following class:
    public class Grunt {
      public static void main(String[] args) {
        System.out.println("Hello Mars");
    }Save it as "C:\Grunt.java", compile by typing:
    javac c:\Grunt.javaRun by typing:
    java -classpath "C:\" GruntDoes it say "Hello Mars"? If yes, go back to your program and compare for differences (maybe you used the "package" statement?).
    Regards

  • Running a java program a set number of times

    This is a general question. Is it possible to make a java program run only 5 times for the sake of arguement.
    Basically I want to write a program that will give the user some flexibility when it will actually run another Java program, but I only want them to be able to say "not now' for a set number of times. When the last time comes the other program will launch. I was initially thinking of the Do Whilw loop, but this needs to work when the program is restarted.
    Program starts, it has 5 times it will run before it does something else(doesn't really matter now I think). User takes option "Not Now" and the program ends, but warns the user this will run 4 more times before you will need to do something.
    This process will repeat until the user takes the option "Ok install now" or the time limit expires and the install occurs anyway. Can someone point me in the right direction.

    ok I see so it's like one those programs that you download for free on the internet and they give you a set amount times to use it before you have to pay for it. but in this case when the number of times you use it equals 5 (or when the user clicks ok) a different java app will open automatically.
    My first thought would be to Write a Serialized object to disk using objectOutputStream that stores the number of times the application has been opened. and each time the program runs it checks for the serialized object and then you can do something like what I posted before. of course if were worried about security the user could always look for the object and erase it, if so then I guess we would have to come up with another plan of attack
    Hope this helps

  • Running a java program from an icon

    I want to run my program from an icon on my desktop. I have a .bat file that I've built a shortcut to and it works.MY GUI program does display and run when I click on the icon. The problem is that the DOS window also shows up behind my GUI.
    Is there anyway to prevent the DOS window from showing? Or is there another way to run a Java program without resorting to a DOS command line or running it through FORTE or another IDD?

    Chris's solution worked well, with one small problem. Once my GUI starts, it takes up the whole screen. Normally when I run it, it appears as a small window.
    not a big problem, I can reduce it easily after it starts. But does anyone know a way to make it come up in the reduced size it norally comes up in when I run it from my IDE?

  • Running a java program via a batch file

    I am unable to run a java program from a batch file that I created.
    spiderpackage.EntryPoint is a class file which I am trying to run with a -v option to output something.What should I do to get the output?
    echo ^<html^>^<body^>
    echo hello^<br^>
    call java spiderpackage.EntryPoint -v
    echo ^</body^>^</html^>

    This has nothing to do with java programming. Have a look at the windows help for the call command.
    The echo <html> stuff doesn't make sense. What's it for?
    The command in you batch file should be:
    java -cp . spiderpackage.EntryPoint -v
    assuming that java is in the system path, and the EntryPoint.class is in a directory called spiderpackage which is a subdirectory of your current working directory

  • Running a Java program at startup in Linux

    Hello
    How do I run a Java program at startup in Linux? I know in Windows I can put a .bat file in C:\Windows\Start Menu\Programs\StartUp\ directory, but in Linux I have no idea how it is done.
    Thank you,
    Mihai

    This is really a Linux question, not Java.
    And then it depends on the version of Linux you are using.
    Maybe this will help, otherwise you should try on a forum for your version of Linux.

  • Running a java program in a directory other than the current directory

    How do I run a java program that's located in a directory other than the current directory?
    There is a file Test.java in /dir1/subdir1. If my current directory is anywhere other than that directory, say /dir2/subdir2, I can compile Test.java by using:
    javac -classpath /dir1/subdir1 /dir1/subdir1/Test.java
    But when I try to run it with:
    java -classpath /dir1/subdir1 /dir1/subdir1/Test
    I get a java.lang.NoClassDefFoundError: \dir1\subdir1\Test
    Any thoughts?

    You need to specify just the name of the class you want to run. So java -classpath /dir1/subdir1 Test

  • Exception while Running a Java Program for UME.

    Hi Experts,
                           I am trying to run a java program to acess UME. Its a sample to create user but all of my samples are throwing this exception in NWDS  (Console).Can anyone tell me why is it throwing this exception .
    com.sap.security.api.UMRuntimeException: UME factory 'com.sap.security.api.IUserFactory' cannot be accessed because UME initialization has not started yet.
    Please check
            UMFactory.isInitialized() before using UME functionality.
        at com.sap.security.api.UMFactory.checkInitialized(UMFactory.java:1019)
        at com.sap.security.api.UMFactory.getUserFactory(UMFactory.java:801)
        at Search.main(Search.java:25)
    Exception in thread "main"
    Thanks in advance
    Somil

    Hi,
    Earlier i faced the same exception when i tried to call the UME form Standalone java application,To resolve this i used stateless session bean approach. i follow the Below Mentioned Steps,
    1:-- create an J2EE -- EJB module project.
    2:-- Create stateless session bean and define the require methods ,implement Local and remote interface methods  in your bean class.
    3:-- refer the UME apis in EJB Projects build path.
    4:-- Call UME in Bean class methods.Build the EJB project and Archive.
    5:--Now create an Enterprise application Project ,Include the EJB module project to your EA Project by right clicking on EA project.Build EA project and EAR file
    6:--Deploy the EAR file on your server.
    7:--Now from your standalone java application include these two projects in Project tab of your Application.
    8:--Lookup the stateless session bean in your java class by its default JNDI name ,Obtain remote or local Home interface,And execute the BEAN Method which deals with UME.
    You can also refer this tutorial in some parts of it UME apis(like IUser,UMFactory) are used in Servelets and EJB ,You can download this tutorial source from SDN for your reference.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/297f35cf-0201-0010-00b2-fe2f3e23d360
    Siddharth

  • Not able to run a java program on Sun Solaris

    Hi All,
    I am getting following error while running a java program. Can you help.
    Thanks,
    --Srini
    Error:
    Exception in thread "main" java.lang.NoClassDefFound

    Hi Sergi,
    Thanks for the info. I couldn't able to login because of my internet connection.
    Thanks,
    --Srini                                                                                                                                                                                                                           

  • How do we run a servlet program in eclipse

    how do we run a servlet program in eclipse.

    Not at all, because servlets require a servlet container. Some Eclipse plugins (Lomboz etc.) do provide integration with those.

Maybe you are looking for

  • How to get the value entered in input enabled field of a list output?

    Hi all, I am developing a program to display  list with two input enabled fields . After users enetered the values into these fields I need to do some calculations based on these values and modify the value of another field in the list. But i couldn'

  • My safari continues to quit unexpectadly and it won't open.

    rocess: Safari [596] Path: /Applications/Safari.app/Contents/MacOS/Safari Identifier: com.apple.Safari Version: 8.0.2 (10600.2.5) Build Info: WebBrowser-7600002005000000~1 Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: Safari [596] U

  • Time Out Dump while extracting data from table CKIS

    Dear Friends, I am getting TIme Out dump for the below code, while extracting data from table CKIS. Table CKIS doesn't have any Indexes. Please guide me to resolve this. Regards, Viji. form get_keko_ckis.   SELECT kalnr kalka kadky tvers bwvar matnr

  • ZERO condition Value in pricing

    Hi Gurus, I have requirement where the condition should allow/accept a zero value when entered in a sales order. It is necessary to fill at least an amount of 0,01 in. Weu2019d like to fill in the amount of 0,00 so that there is no pricing for the it

  • Filesharing via Ethernet

    I am linked to our two other Macs (a G4 iMac running OS X 10.3.9 & new Intel MacBook) and the internet via an ethernet LAN of patch cables and switches. There are no problems with internet access, and in the past it worked fine for local file sharing