Application to Run in Terminal? (Eclipse)

Hi guys,
I am new to Eclipse and would like to create a java project which I can run from the linux (kubuntu) bash terminal.
I've used Netbeans before and building it simply creates a jar file in the dist folder then I can run java -jar HelloWorld.jar and voila it runs.
This doesn't seem to be as straightforward with Eclipse however! (or am I missing something?) Not to dwell too much on why I am choosing to use eclipse over netbeans,
I would really like to (need to, for more memory-intensive project later) get a simple HelloWorld app to run from the linux terminal.
The steps I have followed so far are to create a HelloWorld app in eclipse as follows:
1. Create a new Java application and in Project Layout selected "Use project folder as root for resources and classes"
2. Create a package 'org'.
3. Create a class HelloWorld.java inside org with the following code:
package org;
public class HelloWorld {
      * @param args
     public static void main(String[] args) {
          System.out.println("Hello World!");
}When I build and run the above project in Eclipse, it works fine.
But when running it in the bash terminal, I get the following error:
ltsmm@gertlx:~/eclipse/HelloWorld/org$ java HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong name: org/HelloWorld)
        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$100(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:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)I suspect it has something to do with package names and specified output directories during project
creation?
Having a .jar file to run in the end would be nice but not essential.
If anyone could provide a procedure / some advice for getting this relatively simple thing to work it would be much much appreciated!
Gert
eclipse/packages newbie

Thank you, Pkwooster!
Interestingly, the following works quite well:
ltsmm@gertlx:~/eclipse/HelloWorld$ java org.HelloWorld
Hello World!
ltsmm@gertlx:~/eclipse/HelloWorld$Can I ask why you think the classpath needs to be set when I am running 'java HelloWorld' in the same directory containing the class?
OK this works too, think I see how the classpath works(kind of!):
ltsmm@gertlx:~/eclipse$ java -cp HelloWorld/ org.HelloWorld
Hello World!
ltsmm@gertlx:~/eclipse$Ok the above is ok for a single project now. My (main) problem is referencing another project from within this HelloWorld project.
I have created another project called MyLib (intended as a common library) and created a package 'mycom' and within it a class called MyClass like this:
package mycom;
import java.lang.String;
public class MyClass {
     private String m_name = "";
     public MyClass(String name) { m_name = name; }
     public void showName() {
          System.out.println(m_name);
}Can I reference this project in eclipse from within HelloWorld in such a way that I can run it from the command line? (or even just in eclipse)
I tried the following:
1. Right click HelloWorld project and in Properties->Project references added the "MyLib" project.
2. Modified the HelloWorld class as follows:
package org;
import mycom.*;
public class HelloWorld {
      * @param args
     public static void main(String[] args) {
          System.out.println("Hello World!");
          MyClass obj = new MyClass("blue_obj");
          obj.showName();
}But it doesn't work - not even in eclipse:
"the import mycom cannot be resolved"
do I need to add some jar or something manually?
What I would like to happen when I click 'build' on HelloWorld project is the following (if possible - is this what Ant is for?)
- MyLib to be built into a jar file MyLib.jar
- the MyLib.jar automatically copied to the 'org' folder in HelloWorld (where those classes exist)
- then it should have access to the MyLib code, right? (and should be runnable in the terminal too?)
If this can be done with eclipse and/or an ant file this would be so great!
Help very much appreciated,
Gerry

Similar Messages

  • How to make Applications.app run in terminal?

    Hi,
    Apple has a good way of making Applications.app to launch when double clicked via finder. I am having a hard time, though, when I launch it via terminal. When I try to type in #./Application/Whatever.app the terminal reads it as a folder. In a way, to run it properly I have to go a longer path. I have to run it by typing #./Application/Whatever.app/Contents/MacOS/Whatever.bin. I think running it that way is just too long. I want it to be quick as possible.
    Is there a way to set a path to something like $PATH = "/Application/$Whatever.app/Contents/MacOS/" so that as i tab key in the terminal I would be able to see the binary file right away? Or is there a way to alias the terminal so that when i type /Application/Whatever.app it launches the corresponding binary of that .app folder?
    I am a newbie in Mac but I fairly now how to operate linux systems. Quite frankly I have not explored all the .app folders in my Application folders so I dont know how many binaries exists inside a .app folder.
    I hope you guys got the idea and help me out.
    Thanks,
    Kilopopo

    OK. You may also want to check out the Applescript variants. You can for example run
    <pre>
    osascript -e 'tell application "TextEdit" to open'
    </pre>
    There is a man page for osascript and there is a lot of information about Applescript in different places.
    PowerBook G4   Mac OS X (10.4)  

  • How do I write javacard applications and run them in Eclipse 4.2

    Greetings-
    I have seen some content online about javacard on older versions of Eclipse. I like to ask if it is possible to write javacard applications in Eclipse 4.2? I have an Android development environment, which is basically the bundle that Google provides. I want to know if it is possible for me to use this instance of Eclipse. If not, which version of Eclipse is the one to go with please?

    I will recommend you this plugin (JCDE for eclipse)
    http://sourceforge.net/projects/eclipse-jcde/
    Note that it will only work with JavaCard framework 2.2.2, I am developing applets on Eclipse Kepler (4.2 probably).
    If you dont want to use this plugin, I suggest you try to find or write ANT script which would convert your class files into cap. You would be implementing the applet using standard Java project.

  • "Net use" not working in application that runs as "system"

    Hello,
    I am trying to create an application object to distribute a program which
    during the setup procedure creates two local users on the workstation. I
    tried to set up the application to run as an unsecure system user and
    start the setup.exe. This method worked fine for quite a number of apps in
    the past.
    However this app needs a drive mapping to a windows 2003 server to start
    the setup.exe. Apparently under windows 2003 it is no longer possible to
    use the "net use" command when running a script as system user. I get
    system error 1312 "A specified logon session does not exist. It may have
    already been terminated". There seems to be no solution from microsoft
    since this is probably working as designed.
    In another similar situation I copied the complete setup directory to a
    novell drive, but in this case the setup procedure needs to write
    information into a database located on the windows server. I might be able
    to set up the application via snapshot and create the user accounts using
    a distribution script. But I would need the consent of the windows
    administrators since I need the passwords for those user accounts, and I
    am not sure that they are cooperative in this respect. Furthermore I get
    the feeling that this program is going to present a number of other
    problems and surprises which probably will make the snapshot method very
    tricky.
    Is there any solution or workaround for this problem?
    Any suggestions would be appreciated.

    1) It should not be an issue to run "Net Use" to authenticate to a Windows
    2003 server from an "Unsecure System Prompt". This is quite common.
    2) If the PC is in the domain already, this may be part of the issue since
    you are already authenticated to the domain. Try adding the Domain
    Workstation Object the proper rights.
    3) Does the "Setup.exe" expand to an MSI install in the temp directory? In
    such a case you could like create an MSI install that runs as a normal user
    but the Windows Install will allow for the elevated rights.
    Craig Wilson - MCNE, MCSE, CCNA
    Novell Support Forums Volunteer Sysop
    Novell does not officially monitor these forums.
    Suggestions/Opinions/Statements made by me are solely my own.
    These thoughts may not be shared either Novell or any rational human.
    "Anna Schmitz" <[email protected]> wrote in message
    news:BBvdi.3656$%[email protected]...
    > Hello,
    >
    > I am trying to create an application object to distribute a program which
    > during the setup procedure creates two local users on the workstation. I
    > tried to set up the application to run as an unsecure system user and
    > start the setup.exe. This method worked fine for quite a number of apps in
    > the past.
    >
    > However this app needs a drive mapping to a windows 2003 server to start
    > the setup.exe. Apparently under windows 2003 it is no longer possible to
    > use the "net use" command when running a script as system user. I get
    > system error 1312 "A specified logon session does not exist. It may have
    > already been terminated". There seems to be no solution from microsoft
    > since this is probably working as designed.
    >
    > In another similar situation I copied the complete setup directory to a
    > novell drive, but in this case the setup procedure needs to write
    > information into a database located on the windows server. I might be able
    > to set up the application via snapshot and create the user accounts using
    > a distribution script. But I would need the consent of the windows
    > administrators since I need the passwords for those user accounts, and I
    > am not sure that they are cooperative in this respect. Furthermore I get
    > the feeling that this program is going to present a number of other
    > problems and surprises which probably will make the snapshot method very
    > tricky.
    >
    > Is there any solution or workaround for this problem?
    >
    > Any suggestions would be appreciated.
    >
    >
    >
    >

  • Error: No SAP Business one application is running

    Hi
    I got error "No SAP Business one application is running" when try to start our Add-on from SBO Client using remote desktop.
    Problem Description: Add-on has been installed on server successfully. I want to access remote desktop of the client machine, and when login remotly to the client machine and open SBO client and start our addon from addon manager then it gives the above error.
    If we dont access the client machine remotely and login to the client machine directly then addon connected well.
    suggest me what to do to resolve this error.
    Thanks...

    Hi
    I was just approached by someone else with such an issue...
    We use Windows Terminal Services Client to access training systems - without issues.
    Do you use sth like Citrix with load balancing?
    There such issues might happen, but I don't have a real good idea what the issue might be in your case.
    Maybe someone else has experienced the same problem - and resolved it?
    regards,
    Frank

  • Applications still run after user logged off

    Hi,
    I have a w2k8r2 Terminal server and have a problem that have eluded me for some time now.
    When a user is logged off, by either being disconnected or being inactive for a prolonged time, the user initiated programs are still running.
    To be more exact, Some times when a user is logged off I have the following situation:
    In the task manager on the users tab I cannot see the user anymore (nor in the remote desktop services manager), but in the Processes tab I can still see user initiated programs running. Furthermore I am not able to kill any of those programs, getting an
    "Access is denied" error message.
    My problem is that when the Terminal Server enters this "state" it becomes all buggy and itchy, causing loads of problems for the users that are already logged in (and for the new ones trying to log in). The only solution I have found is rebooting
    the server.
    Any solution, or further troubleshooting steps, are more than welcome. For me the next step is reinstalling which I really don't want

    1. Check any task schedular is running for application or not,
    Refer :
    http://answers.microsoft.com/en-us/windows/forum/windows_7-security/if-i-log-off-at-night-leave-computer-on-will/559eec53-1d2a-46f8-ac12-f0d4a32ab57a?msgId=b51d42b3-e727-40c0-b94e-8a01b31bf526
    2. Also update Antivirus and scan completely.
    3. Is it specific application or all the application, Which user opened in his session?
    4. If specific application is running (In this scenario Outlook is running even user logs off), Try the below Citrix forum thread.
    Refer :
    http://discussions.citrix.com/topic/301644-user-logs-off-process-outlookexe-stays-active-error-the-citrix-server-has-reached-its-concurrent-application-limit/
    5. Check and update  TCP/IP driver
    Refer : http://support.microsoft.com/kb/2465772/en-us
    6. Also cross verify Dharmesh suggestions also.
    Regards,
    Manjunath Sullad

  • [SOLVED] cannot run gnome-terminal or rxvt

    I am running Arch 64 with GNOME. Every time that I try to run gnome-terminal, it simply flashes for a split second and disappears. it does not seem that rxvt is even invoked when I click on it, and I am not sure how to proceed.
    Here is what I have done:
    1.The problem started when I got openbox under GNOME up and running. I thought that openbox did something odd, so I removed it. (I don't think a window manager would damage applications, but I'm kinda knew to swapping them around)
    2. I went ahead and got metacity running again.
    3. I reinstalled GNOME.
    4. I double checked previous forum posts, and I indeed have a default shell (now zsh, see below)
    5. I went ahead and installed zsh. It works just fine in tty, and 'echo #SHELL' properly returns '/bin/zsh'
    Ideas?
    Last edited by electricaltape (2010-05-17 23:28:38)

    The only problem is with terminals; all other applications in X work fine. I don't think it is a driver problem since the terminal only began to misbehave after I installed/uninstalled openbox. I am not sure where to look for error messages; is there some logfile I can check?
    I think kazuo is on to something.
    DISPLAY=:0 gnome-terminal
    has the output (in tty1)
    Invalid MIT-MAGIC-COOKIE-1 keyFailed to parse arguments: Cannot open display:
    UPDATE : The install I had was pretty fresh anyway, so I just reformatted. Therefore, no more problem.
    Last edited by electricaltape (2010-05-17 23:29:00)

  • Connection leaks and application is running out of connection

    Hi All,
    We have configured the SQL Database external resource for OBPM specific connection pool. All the business processes are using the Fuego.Sql package for the data base transaction calls. I have no clue how this package is managing the database connections. If more than 25 users perform concurrent testing, the application is running out of connections. Connection pool configuration details as below.
    Maximum Pool Size : 500
    Maximum connections per user : 50
    Minimun Pool Size : 0
    Connection Idle Time (mins). : 5
    Maximum Opened Cursors : 1000
    Please share your thoughts on how I can track and fix this issue. Also please let me know the answers below.
    1. Is there any way to find out the stats about the connection pool
    2. If I configure the remote JDBC that points to J2EE datasource, would that fix this issue.
    I appreciate your help.
    Thanks,

    Can anyone please share your ideas?
    Thanks,

  • Images are not comming out when application is running through jar file.

    I have written an application program using j2sdk1.4.1 that needs your help.
    My application folder's contents.....................................................................................
         C:\Examination\Examination.class <-----This is the main class and application's entry point.
         C:\Examination\ExamBox.class
         C:\Examination\PaperSetterBox.class
         C:\Examination\pspBox.class
         C:\Examination\epBox.class
         C:\Examination\TimerBox.class
         C:\Examination\ReportCardBox.class
         C:\Examination\HelpBox.class
         C:\Examination\AboutBox.class
         C:\Examination\Images\(some jpg & gif files)
         C:\Examination\Sounds\(some au files)
    Compilation Report:     There was no error.
    Execution Report :     Was working properly using the command:- java Examination
    Now, I created a jar file for my application in the following steps.................................
              STEP-1:          Firstly, I created a text file(mainclassInfo.txt) that contains
              the line:--     Main-Class: Examination
              This line would be automatically added to the default manifest file when I would include the                name of that text file with the command to create the jar file.
              Location of the text file I created:     C:\mainClassInfo.txt
              STEP-2:          Then I went to C:\Examination and executed the following command(by using                'Command prompt'):--------------------------------------------------------------------
    jar cmf C:\mainClassInfo.txt Examination.jar Examination.class ExamBox.class PaperSetterBox.class pspBox.class epBox.class TimerBox.class ReportCardBox.class HelpBox.class AboutBox.class Images Sounds
    Finally, I got the jar file:-     Examination.jar
    Double clicking on it application ran as it was expected.
    Then, I thought, that as all the files & folders the application needed to run properly were packaged in the jar file; I should delete all the contents of the folder 'Examination', so that no one could see or use anything of the resources easily. I did that.
    So, then it became only:-- C:\Examination\Examination.jar
    Thereafter, I tried to run the application again and there a problem occurred! The application was running, but the images, those were to be used and shown by the application were missing somehow!!
    Moreover, when I kept a copy of those 2 folders('Images' and 'Sounds') into the C:\Examination and ran the application again all the images came out normally!
    I just can't understand why it's happening so mysterious?
    I don't want to leave anything of the resources in an open place; I mean, outside of the jar file. The images should be used and shown by the application.
    Help me please!

    The Image class itself does not have any methods for loading images from files so you must be using something more. Most methods for loading images from files have an overload that lets you use a URL, so you just need to use that method with a call to getResource like in the other thread. If you can't think of anything else, you can use ImageIcon to load an Image (the Image is returned by a call to ImageIcon.getImage). See also "how to use icons" from the swing tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html

  • Finder got an error. Application not running (-600)

    I have a LaunchAgent that calls a shell script, at login.  The shell script runs and determines the users AD container and then will runn the correct applescript application depending on the AD Container.    The applescript applications simply mount up the users network volumes, runs a few do shell scripts and then exits.
    It works and has been working for quite some time, under 10.5.x, 10.6.x, 10.7.x and even 10.8.x.  But I have started getting a few users who are getting a rather odd message in the logs that the script creates and I can't really find anything on the error message.
    "Finder got an error.  Application not running (-600)"
    If I log the user in and run the following at the command line:
    launchctl unload name.of.plist 
    It will unload the launchagent.
    If I type this at the commane line:
    launchctl load name.of.plist
    It works perfectly.  No errors.
    I can manually run the shell script it calls and that works fine.
    I can also manually double click the apps and those run fine. 
    I've changed the permissions, I've recopied, re-imaged, but I can not figure out why the script won't sometimes and gives me that error message.
    Has anyone seen this error message before and what I can try to do to fix it?
    Thank you in advanced.

    This sounds like a typical race condition, and it's impossible to solve without seeing the script.
    The issue is that your script is targetting some application that isn't available. Ordinarily AppleScript will launch an application if it's not already running, but during launch it's possible that your script is trying to target an application before it can be launched (because the user's envirnment is still loading).
    So you need to look at the script to see what it's doing, and what apps it's targeting. The fix might be as simple as adding a few delays to allow the system to finish logging in, but t's hard to say without more data.

  • App store and applications not running correctly on the 4GS

    I upgraded my iphone last night from the 4G to the 4GS,   I downloaded all of the updates and the back up.  today my phone is very slow, the APP store will not load, and other applications are running very slow or will not open.  I have rebooted my phone,  deleted apps such as netflix and face book re downloaded, earlier was able to, now I cannot.    Does anyone have any suggestions,    wondering why I upgraded my phone??????

    See [[Installing a previous version of Firefox]]
    If you are going to use Firefox 3.0, you should try the last version 3.0.19 rather than 3.0.1

  • Does anyone know of a VI or how to go about writing one that will prevent the computers time/date from being disabled while an application is running.

    Does anyone know of a VI or how to go about writing one that will prevent the computers clock/time from being disabled while an application is running. The time and date can normally be reset while an application is running by clicking on the time/date in the lower right-hand corner of the computer screen. I have an application that runs over several days and it is critical that the time and date of the computer not be changed. Is there an easy way to lock this out from the user? Note that I am what I consider an advanced beginner in LV.
    Thank you,
    Chuck
    Solved!
    Go to Solution.

    That is not something you can do from LabVIEW, as it is an operating system operation, and it will depend on the operating system that you're using. On Windows you can use a group policy to control this. Please Google on "prevent time and date change in windows".
    Also, please try to refrain from stuffing your entire message in the subject block. Keep the subject short, but descriptive enough so it can be understood what you are basically asking. Thanks.

  • I have an OpenGL application that run in a window. I would like to use this application and use its window in a VI interface. Note t

    hat I DON'T WANT TO OPEN the window application FROM the Labview VI BUT IN the Labview VI. I think it's possible to do that and to do communicate the OpenGL application with the Labview Interface using an ActiveX but I don't know how. Can someone help me ?You can answer the question or send it at [email protected]
    Regards.
    Cyril

    hat I DON'T WANT TO OPEN the window application FROM the Labview VI BUT IN the Labview VI. I think it's possible to do that and to do communicate the OpenGL application with the Labview Interface using an ActiveX but I don't know how. Can someone help me ?The desired behavior you desribed may not be possible with that application. In general LabVIEW does not offer a window object that other standalone applications can run it. The closest thing is the ActiveX container. If the programmers for your application created an activeX control of your program and they provided documentation, it should be pretty easy to incorperate the app and labview into one window. I recommend contacting the manufacuturer of the app to see if they have an activeX control version of the app.

  • How do I know if my application is running from within WebLogic server

    I have an application that could be running either as a standalone
    application (with its own VM) or as a servlet (within the WebLogic's
    VM). How can the application determine the environment in which it is
    running?

    We have a similar situation here and we took the approach suggested below.
    It does work, however it is creating one problem for us.
    Sometime after the code below executes, our application attempts to
    construct
    the initial JNDI context (in order to look up an EJB Home). In the case
    where
    our application is running outside of a WLS instance, we get the following
    exception:
    Exception in thread "main" java.lang.NoClassDefFoundError:
    weblogic/rjvm/LocalRJ
    VM
    at
    weblogic.t3.services.OutputFilePropertyClient.getValue(OutputFileProp
    ertyClient.java:48)
    at weblogic.rjvm.RJVMManager.initialize(RJVMManager.java:78)
    at weblogic.kernel.Kernel.ensureInitialized(Kernel.java:137)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:182)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java:195)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLIni
    tialContextFactoryDelegate.java:148)
    at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialCont
    extFactory.java:123)
    at
    javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    71)
    at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:242
    at javax.naming.InitialContext.init(InitialContext.java:218)
    at javax.naming.InitialContext.<init>(InitialContext.java:194)
    ... application code here ...
    It would appear that the failed call to getT3Services() is leaving the
    Weblogic client
    runtime in a bad state (if we remove this call, there is no problem
    constructing the
    context).
    So, the question I have is "is there any *safe* way to determine if an
    application is
    running within a WLS?". Thanks in advance for any additional suggestions.
    Sean
    "Wei Guan" <[email protected]> wrote in message
    news:[email protected]...
    Try this:
    boolean isInsideWLAS=false;
    try
    T3Services.getT3Services();
    isInsideWLAS=true;
    catch (Exception e)
    My 2 cents.
    Cheers - Wei
    Cheers - Wei
    Adane Zygta <[email protected]> wrote in message
    news:[email protected]...
    I have an application that could be running either as a standalone
    application (with its own VM) or as a servlet (within the WebLogic's
    VM). How can the application determine the environment in which it is
    running?

  • How to compile and run servlets in Eclipse?

    Does somebody known how can I compile and run servlets in Eclipse IDE? I've added and configured Tomcat's plugin. I've created a project with my example servlets source, and I don't know what farther. How do I have compile it without main method? I must add web.xml file from Tomcat's directory into projects in Eclipse and modify it?
    THX Chudzik

    Try googling for "eclipse servlet", surely someone has written instructions.

Maybe you are looking for

  • Should I install Yosemity on an MacMini 2.53Mhz Duo ?

    Hi - should I install Yosemity on an MacMini 2.53Mhz Duo ? Late 2009 model. The mini is currently whizzing away with Mountain Lion.  Other stats 4 gig memory (I know I could vamp up to 8), 500 HD hard drive Am really happy with Mountain (was previous

  • Search Help for standard field in WEB GUI

    Hello Experts There are F4 help for Business Partners (street and district that are standard address fields) and it is visible from SAP GUI. However in WEB UI there are no input help (although they are standard) for these fields. Is there customizing

  • Using Aiport Express and internet at the same time?

    I was just wondering if anyone could offer any advice on this subject please? I've got a Macbook running through a wireless BT ADSL modem. I have also managed to connect the Macbook to my Aiport Express to allow me to wirelessly pipe iTunes through m

  • Show-stopper How can I determine tab hierachy from ids in wwpob_page$

    I have application components published as portlets that depending on the particular page/tab combination perform various functions. I am able to get the page_url from my report components published as portlets through p_page_url. The URL obviously k

  • How to pass a variable in current class for access in next class.

    Hi Everyone, I'm new in this iphone development.so please anyone help me . My question is How can we declare a variable for, select a row in current class which read as input string in next class Soap Message. Means in my 1st class i am getting web r