Java command not working

Hi
I m learning java since few weeks.... I am facing problem in running java class using java command.I have a folder as
D:\deepali\Bday\Birth\web-inf\classes\BI
in this folder i have TryAPI.java file. Its getting compiled properly. but whenever i give command as
java TryAPI
it gives me the following error
D:\deepali\Bday\Birth\web-inf\classes\BI>java TryAPI
Exception in thread "main" java.lang.NoClassDefFoundError: TryAPI (wrong name: BI/TryAPI)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
My path is
D:\Oracle\Ora81\bin;C:\Program Files\Oracle\jre\1.1.7bin;C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem;;D:\tibco\tibrv\BIN;C:\j2sdk1.4.2_05\lib;C:\j2sdk1.4.2_05\bin;;D:\tibco\BIN;C:\TIBCO\TIBRV\BIN;
Can anyone explain me why this is happening?
Thanks and Regards
Deepali

You see the error message that says "wrong name. . ."?
That means you used the wrong name for the class. You have it in a package, but you didn't use the package name. (You have to)
This is a minimal explanation of packages.
Assume that your programs are part of a package named myapp, which is specified by this first line in each source file:
package myapp;
Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
Then a statement to compile your source file named aProgram.java is:
C:\java\work\>javac myapp\aProgram.java
And a statement to run the program is:
java myapp.aProgram
(This can be issued from any directory, as Java will search for the program, starting the search from the classpath directories.)
Explanation:
Compiling
A class is in a package if there is a package statement at the top of the class.
The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
Running
Compiling creates a file, aProgram.class in the myapp directory.
(The following is where people tend to get lost.)
The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name)

Similar Messages

  • Java command not working - path problem ?

    Im not really new to Java, but rather new to Linux :=)
    Ive got NetBeans setup and working great on Redhat 7.2 and I can run Java apps from within the IDE...but not from a command line. I get "bash: java: command not found"
    This tells me something is amuk with my path, because obviously the bin folder is not on the path ???
    Help :=)

    also, ive got this in my .bashrc file
    #JDK Home varible
    JDK_HOME=/usr/java/j2sdk1.4.0_01

  • Crontab reboot command not working

    Crontab reboot command not working
    Greetings
    I am new at this so excuse any ignorant mistakes I might be making.
    I have a server (MM X.4.9) that I would like to restart every day in order to make sure no programmes are hanging etc. If a program is hanging is should force quit it. Using terminal I have entered the following command:
    sudo nano /etc/crontab
    Entered password
    Than I entered using tab between each sequence:
    15 13 1 1 * root reboot
    This was a test run and it did not reboot.
    Entering
    cat /etc/crontab
    I got:
    # The periodic and atrun jobs have moved to launchd jobs
    # See /System/Library/LaunchDaemons
    # minute hour mday month wday who command
    15 13 1 1 * root reboot
    What have I done wrong?
    Thanks

    Hehe, there you are experimenting with a "reboot" cron command and you are surprised it quit so fast. You are not going to find a "graceful" solution to shutdown dialogs.
    MSWord is a Java app, so it is especially important for the command to work that it doesn't get hung up on outer layers of the system. Especially stupid apps that use Java which is not well integrated. I believe Word has a 5 minute autosave, so you should be able to recover most of your document.
    This reboot command should be running around 2AM, when the average webserver has minimum traffic. If you feel the need to reboot during busier times of the day, I'd suggest you look at what's causing your applications to crash.

  • Java does not work at all upon using the update manager to update to firefox 3.6.10 for Ubuntu 9.0.4

    OS: Ubuntu 9.0.4
    Browser: Firefox 3.6.10
    upon updating to firefox 3.6.10, java does not work at all.
    websites that use java do not work at all anymore, when they worked just fine before the updating thru update manager. e.g. hulu website cannot play any of the shows.
    i can give the folder of bookmarked pages i tried.
    how to do that on here, i've yet to see if possible.
    i can even give saved text from the terminal concerning certain attempts.
    when i updated thru update manager, it gave some weird java plugin that wasn't there before "The IcedTea Web Browser Plugin IcedTea6 Java Web Browser Plugin (execution of applets on webpages)".
    i uninstalled this as instructed by an answer found in one of the pages i saved, cuz it was conflicting w/another java program the updater said i needed. right now, i don't remember for sure what it was. it perhaps was realplayer flash or Java itself. w/all the hours/days of searching i put in, it's difficult if not downright impossible for me to remember all the specifics of what i tried.
    i've searched throughout many webpages (including many searches on mozilla, ubuntu, java, etc) for instruction in fixing the problem.
    oh, and incidentally, on the Java site, when i try the verify test of Java, firefox pops up with that yellow bar right below the slew of tabbed website windows, giving the statement "additional plugins are required to display all the media on this page. (w/link to) install missing plugins ." which is what i do, go thru the requesting plugin installation. it comes up with, guess what, the IcedTea Java Plugin. i click on the 'next' in the "Plugin Finder Service" box that pops up, & all it gives me is "No plugins were installed. IcedTea ...Plugin failed. and the link 'find out more about plugins or manually find missing plugins'". the link takes me to some of the very things/plugins that wouldn't install in the first place. the Java test failure is a LOL funny, as what plugin it is saying is required (IcedTea) is a recommended alternate program to display the very test in the first place.
    i followed the given instructions on those many searched pages, in every case (barring what i may have just plain missed), but to no avail.
    i've even gone to the point of trying to reinstall the previous 3.5.13 firefox version, from mozilla site. even that wouldn't install.
    i've tried installing Java for my sys direct from it's site. nada.
    now it's time for me to post the problem & perhaps someone will come up with some kind of "dummy" way to fix it.
    until then many sites a regularly use are totally useless to me on this fast puter.
    the only way i can get to use such sites, are two choices: 1. use a dinosaur laptop, which is slower than molasses & cannot handle to any streaming stuff, or 2. use an available internet access puter at the library. but useage for ea person per day is limited to only one hour a day. and one can end up waiting for an hour or more ( in the busiest periods) to even get to use one.
    so, is there anyone at all, who knows any for-sure working fix for this problem?
    thanks muchly :^D
    p.s. i can't pay anybody any money for such help, as is required in certain sites (e.g. Java website), cuz i don't have any.
    i can pay in labor tho, if there is someway to find someone who can physically be at this puter w/me, taking me step-by-step
    sorry for the 20-pg essay. i hope it was all clearly understood. if, not, well, clear communication is always what is needed, ask away.

    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 9.0 r999
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    In Firefox 3.6 and later versions you need the Next-Generation Java™ Plug-In present in Java 6 U10 and later (Linux: libnpjp2.so; Windows: npjp2.dll).
    http://java.com/en/download/faq/firefox_newplugin.xml
    See also http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html

  • HT1338 I installed Mac OSX Snow Leopard 10.6.3 And now my Java is not working, what can I do to fix's this?

    I installed Mac OSX Snow Leopard 10.6.3 And now my Java is not working,what can I do to fix's this?

    Run Software Update to get to 10.6.8 and update Java.

  • Java Plugin not working with firefox 3.o.13  and linux.

    this is my ln -s to the plugin at /usr/lib/mozilla/plugins
    libjavaplugin_oji.so -> /usr/local/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so
    Any ideas why java is not working?
    Here's the ln -s again:
    #pwd
    #/usr/lib/mozilla/plugins
    # ls -l
    lrwxrwxrwx 1 root root 63 Sep 28 20:41 libjavaplugin_oji.so -> /usr/local/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so
    Here are my java stats:
    # java -version
    java version "1.6.0_16"
    Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
    Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
    Firefox 3.0.13:
    Mozilla/5.0 (X11; U; Linux i686;
    Gentoo Linux:
    # uname -a
    Linux tma 2.6.30-gentoo-r5 #10 SMP Sun Sep 20 21:52:19 PDT 2009 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux
    I installed java from a jdk*.sh file and set the class path in /etc/bash/bashrc (not that it matters.
    The appletviewer does work.

    solved: I knew you all knew I could figure this out.
    #cp -R /usr/lib/mozilla/plugin/ /usr/lib/firefox-mozilla/
    asuming this is true:
    tma plugins # pwd
    /usr/lib/mozilla/plugins
    tma plugins # ls -l
    total 4
    lrwxrwxrwx 1 root root 63 Sep 28 20:41 libjavaplugin_oji.so -> /usr/local/jdk1.6.0_16/jre/plugin/i386/ns7/libjavaplugin_oji.so
    tma plugins #

  • Alt ctrl c shortcut command not working in photoshop cc, it is opening Internet explorer (IE)

    In Photoshop CC 2014  Alt + Ctrl + C ( to open for canvas size dialog box ) command not working, it is opening Internet Explorer (IE)

    What version of windows are you using?
    See if the Internet Explorer shortcut has that keyboard shortcut assigned to it.

  • Bash commands not working after upgrade to Lion

    After upgrade, many BASH commands not working. For example, such a fundamental thing as "ls". 
    iMac20:bin a$ ls
    Launch of "ls" failed: the PowerPC architecture is no longer supported.
    What does it have to do with PowerPC? My computer is 2.66 GHz Inter Core Duo

    Linc,
    iMac20:~ a$ which ls
    /sw/bin/ls
    Also, I managed to look (using tcsh's ls-F command) into the contents of /usr/. Here's what I see there:
    [iMac20:/bin] a% ls-F
    [*          csh*        echo*       ksh*        mkdir*      rcp*        stty*       wait4path*
    bash*       date*       ed*         launchctl*  mv*         rm*         sync*       zsh*
    cat*        dd*         expr*       link*       pax*        rmdir*      tcsh*      
    chmod*      df*         hostname*   ln*         ps*         sh*         test*      
    cp*         domainname* kill*       ls*         pwd*        sleep*      unlink*    

  • Why is my BDC_CURSOR command not working to position the cursor?

    Why is my BDC_CURSOR command not working to position the cursor?  Here are the details regarding my issue.
    I am writing a BDC to mass delete routing material assignments using transaction CA02.  I am OK to navigate through the initial screen to go to the Header screen and from here I am OK to navigate to the Material Assignments screen.  But once here, I cannot get the BDC_CURSOR command to take me into the list.  Here are the commands I am using.  Please let me know what I may try differently.
    CA02 Material Assignment - Set position  <-- this resets list of materials to correct position
      PERFORM bdc_dynpro      USING 'SAPLCZDI'   '1010'.
      PERFORM bdc_field       USING 'BDC_CURSOR'  'RC27X-ENTRY_ACT'.
      PERFORM bdc_field       USING 'BDC_OKCODE'   '=ENT1'.
      PERFORM bdc_field       USING 'RC27X-ENTRY_ACT'  c_position.
    CA02 Material Assignment - Delete
      PERFORM bdc_dynpro      USING 'SAPLCZDI'   '1010'.
      PERFORM bdc_field       USING 'BDC_CURSOR'  'MAPL-MATNR(01)'.    <-- this is not working to set the cursor into the list
      PERFORM bdc_field       USING 'BDC_OKCODE'  '=LOE'.             " trash can
      PERFORM bdc_field       USING 'RC27X-ENTRY_ACT'  c_position.
    CA02 Material Assignment - Green Check OK
      PERFORM bdc_dynpro      USING 'SAPLCZDI'   '1010'.
      PERFORM bdc_field       USING 'BDC_CURSOR'  'RC27X-ENTRY_ACT'.
      PERFORM bdc_field       USING 'BDC_OKCODE'   '=BACK'.            " check mark
      PERFORM bdc_field       USING 'RC27X-ENTRY_ACT'  c_position.

    Thank you for your reply.
    I had used SM35 to record.  However, I was not aware of the "create program" feature.  I had commented out a section from my previous post which I have now added back (latest code below).  But it still did not resolve the issue.
    When I execute with dismode = 'N', I get back error message "No batch input data for screen SAPLCZDI 1010".
    When I execute with dismode = 'E' (only show dynpros when error), it stops at the material selection screen without placing my cursor in the list.  I can then MANUALLY click to set the cursor position in the list, MANUALLY click the trashcan, it then uses my BDC command to respond to the popup asking "Do you want to delete", still leaving me at the material selection screen.  I can then MANUALLY click the green check (or enter), then it continues with the BDC to go back to the previous screen, and saves.  But it still will not place my cursor in the material selection list (SAPLCZDI screen 1010).
    Here is code used.  It is the second section of code labeled "CA02 Material Assignment - Delete" that is not working.
    CA02 Material Assignment - Set position
    this code functions to position the desired material to first in screen list
      PERFORM bdc_dynpro      USING 'SAPLCZDI' '1010'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC27X-ENTRY_ACT'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=ENT1'.
      PERFORM bdc_field       USING 'RC27X-ENTRY_ACT'
                                     c_position.
    CA02 Material Assignment - Delete
      PERFORM bdc_dynpro      USING 'SAPLCZDI' '1010'.
      PERFORM bdc_field       USING 'BDC_CURSOR' 
                                    'MAPL-MATNR(01)'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=LOE'.             " trash can
      PERFORM bdc_field       USING 'RC27X-ENTRY_ACT'
                                     c_position.
    Acknowledge Pop-Up Screen
      PERFORM bdc_dynpro      USING 'SAPLSPO1' '0100'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=YES'.
    CA02 Material Assignment - Green Check OK
      PERFORM bdc_dynpro      USING 'SAPLCZDI' '1010'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                    'RC27X-ENTRY_ACT'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                    '=BACK'.            " check mark
      PERFORM bdc_field       USING 'RC27X-ENTRY_ACT'
                                     c_position.

  • Java 7 not working on new (4/2/13) OS 10.8 machine

    I downloaded Java 7 and the app is not working.
    Checked it on Java site and it is not functioning.
    Validated Java is enabled in browser
    Cleared Cache...
    Not sure what else to do.
    Was going to uninstall and re-install with security off, but am not sure how to uninstall. My first Mac....
    Thanks in advance.

    I had a similar problem running Java with OSX 10.8.3.  Even after performing the latest software update (including Safari 6.0.4) in addition to download and installation of the latest version of Java (version 7 update 21), Java did not work. And the “Java icon” was absent from the “system preferences” menu (should be at the bottom under the tab “other”). Very strange! But I found a solution: 1.) Go to “Library > Internet Plug-Ins”; 2.) Move all JavaAppletPlugins to trash (I moved “JavaAppletPlugin (1.7.10.18).plugin” and “JavaAppletPlugin.plugin”); 3.) Download and run the latest Java update; 4.) re-launch Safari.
    That solved my problem and I can run Java applications in Safari. Again......

  • Java is not working any more

    The last 6 months Java has not worked at all. I have Java 1.4.2 and 5.0 installed. I have tried re-installation, emptying buffers, resettings safari, using other browsers, created new user account in OSX and so on. I have tried all the tricks in the book and I have talked with other people that have the same problem without being able to find a solution.
    My theory is that everything went wrong with the last java update, and I'm wondering whether Apple will release another update also including Java 1.6. I have waited quite long now, hoping for a update, but it doesn't seem to happen. Does anybody have some ideas on what I can do to get Java working again.

    HI punsk and Welcome to Apple Discussions ...
    Since you're having so much trouble with Java, you might consider backing up your files and doing a complete erase and reinstall. Not an Archive and Install, ERASE and start over. Once you do that, go to Software Updates available from the Apple menu; Apple/Software Updates and start from scratch.
    If you do this, after this is finished, run Disk Utility from your Applications/Utilities folder and Repair Disk Permissions.
    Also, on your iBook. Make sure you have available drive space for updates. Open Disk Utility, select MacintoshHD in the panel on the left, then look down right side of window and you'll see:
    Capacity and Available. Make sure your Available drive space is at least 20% of the total drive.
    Carolyn

  • Java 7 not working on OSX 10.8.3

    I need some help with Java 7.
    I am trying to open my photo lab software, however, it keeps giving me a message saying I need to download the Java Runtime Environment. I clicked on the link and it brought me to the Java site. I sucessfully download the software but it still doesn't work even though Java test show's it's working.
    I'm running OS X 10.8.3.
    I downloaded the softwared using Firfox don't know if that makes a difference.
    I've checked my Java setting and they all seem to be enabled. At this point I have not idea whats going on. I didn't have this problem before and can't figure out what to do.

    I had a similar problem running Java with OSX 10.8.3.  Even after performing the latest software update (including Safari 6.0.4) in addition to download and installation of the latest version of Java (version 7 update 21), Java did not work. And the “Java icon” was absent from the “system preferences” menu (should be at the bottom under the tab “other”). Very strange! But I found a solution: 1.) Go to “Library > Internet Plug-Ins”; 2.) Move all JavaAppletPlugins to trash (I moved “JavaAppletPlugin (1.7.10.18).plugin” and “JavaAppletPlugin.plugin”); 3.) Download and run the latest Java update; 4.) re-launch Safari.
    That solved my problem and I can run Java applications in Safari. Again......

  • Java Safari Not Working

    Hi all, I am running 10.4.11 with the new safari but now I believe my java is not working right anymore. I am getting the mug with arrows and no response when I try to upload photos onto places like facebook and costco. I have gone through the software update but it says I am all up to date. As well, I need to access the following site:
    http://www.cra-arc.gc.ca/esrvc-srvce/tx/ndvdls/myccnt/menu-eng.html
    and the following comes up...
    "Java applet unable to load"
    then..
    +On Macintosh Operating Systems:+
    +Mac OS X version 10.4.+
    +Browsers Supported:+
    +Safari 2.0.4 (Webkit 419.3 or higher).+
    +Apple JVM 1.4.2_07 to 1.4.2_16;+
    +Apple JVM 1.5.0_05 or higher.+
    +Safari 3.0.4 (Webkit 523.12 or higher).+
    +Apple JVM 1.4.2_07 to 1.4.2_16;+
    +Apple JVM 1.5.0_05 or higher.+
    Any help?

    Commiserating with you Seanifer - I cannot get Java-based Webinars (Citrix) to load either. As a test of a theory, I tried to load the same webinars in Firefox. It too didn't load - I suspect it's an issue specifically with Java and not necessarily with Safari.
    I too have all software updated - I'm running in Leopard v10.5.6, running Safari v3.2.1 and Java Web Start 12.2.0. Firefox v3.0.6
    We might want to begin with temporarily removing the plist for Java. Do you know how to do this (I do - I'm asking so as to know how detailed my assistance should be for you).
    I have the following Java components loading in this order:
    Java applet versions
    J2SE 5.0 32bit
    Java SE 6 64-bit
    J2SE 5.0 64bit
    J2SE 1.4.2 32-bit
    Java application versions
    J2SE 5.0 32bit
    Java SE 6 64-bit
    J2SE 5.0 64bit
    J2SE 1.4.2 32-bit
    I believe these are the "default" settings as seen in my Java Preferences panel.
    Rolling-up my sleeves on this one! Stay tuned.
    - mp

  • Java apps not working right

    I lately have found problems with Java apps not working correctly. For example, in Yahoo Widgets I cannot get any widget preferences to display; in Apple's Java Preferences for J2SE 5.0 the preference window opens but is blank; and in JBidwatcher the buttons are missing in main and preference windows.
    When I log in as another user I find all those apps work properly, so it seems to be something wrong within my User folder. I tried reinstalling the Java J2SE50ReIease4 but it didn't help. Is there something I can delete and/or reinstall to fix this problem?

    Ditto here,
    I made the mistake of thinking I could throw away the preferences in the Java folder and new pref's would automatically replace the missing pref's, much to my surprise no such thing happened. My settup is the same as yours, except my OS is 10.4.8.
    Someone please help.
    Thanks,
    BJZTX
    G5 D2GHz   Mac OS X (10.4.7)   G4 Notebook 10.3

  • Java applet not working savevid keepvid

    Hi all,
    I'm sure I'm not the only one who has been confounded by Java applets not working in certain download web services; in my case, keepvid.com and savevid.com to download copies of youtube videos.  It has been a huge headache and even debilitating in my case.  I teach film and video to middle schoolers, and we often use youtube as a resource for our class projects. 
    I found a solution today, I think, and wanted to share it:
    I installed the browser called "Torch" and it seems to work fine, so far.

    thanx 4 replying
    using the browser to view Applet is not recomended that is because if u change the the source-code and recompile the applet then run it using the broswer it will run the old-version
    Also i've found the solution here
    http://www.cs.utah.edu/classes/cs1021/notes/lecture03/eclipse_help.html

Maybe you are looking for

  • New tech help install new hard drive

    Installing a new drive in late 2007 MBP. Read about cloning drives et al. using carbon cloner. Instructions for cloning to an already formatted external verbatim HD - by dividing an existing partition looks simple enough. http://help.bombich.com/kb/o

  • How to change the unload priority of a table in SAP HANA?

    Hi Experts, How we can change the unload priority of a table in SAP HANA? I know by default the priority is 5. Is there any way so that we can check the unload priority of a particular table in HANA studio? Is there any SQL statement to get the same?

  • Importing a CSV file into AD 2012r2

    Hi Guys Just wondering if anyone can help, I am a newbie on scripting and finding it really difficult to understand how to import a csv file into AD I have created the CSV file with the following headers, see below but I am unable to write a powershe

  • Pages in a Tabbed Page

    Can somebody point me in the right direction. The functionality I am trying to achieve is by linking a number of pages to my tabbed page and subject to the user logging on will only be able to see their relevant page. The page is to be displayed dire

  • Although the AirportExtreme's green light is on, I can't get any Internet connection. I've tried everything, but to no avail! What can I do?

    While I was using the internet, the connection was suddenly lost, although the green light of the AE was still on. There was no warning whatsoever. Since then I have tried everything I could think of: I consulted Network Diagnostics & Configurations,