JAR FILE IS NOT DETECTING IN WINDOW

hi
I am facing some problems during package creation
My current J2SDK is 1.5.0_02-b09
I create one packge called as p1.jar
It consist of one class & one interface
sa.java
package p1;
public class sa
     private int a,b;
     public sa(int a,int b)
          this.a=a;
          this.b=b;
     public void showval()
          System.out.println(" a="+a+" b="+b);
sb.java
package p1;
public interface sb
   public int s1=34;
   public int s2=43;
   public void  takeme(int a,int b);
/code]
I create a jar file and set its path in
MY COMPUTER ---->advanced --------->Environment & variables ----->classpath
if i specify  import p1.* in  the following manner import p1.*;
public class demopack implements sb
     int a,b;
     public demopack(int a,int b)
          this.a=a;
          this.b=b;
     public void takeme(int x,int y)
          a=s1+x;
          b=s2+y;
          System.out.println("a="+a+" b="+b);
     public static void main(String[] args)
               demopack d=new demopack(10,20);
               d.takeme(12,23);
               sa s=new sa(12,23);
               s.showval();
Following Error is executing
Z:\javademo>javac demopack.java
demopack.java:4: cannot access sb
bad class file: .\sb.java
file does not contain class sb
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
public class demopack implements sb
                                 ^
1 error----------------------------------------------------------------------------------------
but if i mention import statement in following way there are no error
import p1.sa;
import p1.sb;
public class demopack implements sb
     int a,b;
     public demopack(int a,int b)
          this.a=a;
          this.b=b;
     public void takeme(int x,int y)
          a=s1+x;
          b=s2+y;
          System.out.println("a="+a+" b="+b);
     public static void main(String[] args)
               demopack d=new demopack(10,20);
               d.takeme(12,23);
               sa s=new sa(12,23);
               s.showval();
Is above mention problem is version problem
For user defined package Every time I have to import individual class ?
Is any alternative Solution (excluding -classpath option of javac)

Well
I follow your instruction
I am pasting the command prompt operation
Coding is same above
My all three files (.java )is resides in javath folder
command prompt code
Z:\javath>javac -d . sa.java
Z:\javath>javac -d . sb.java
Z:\javath>jar -cvf p1.jar p1/*.class
added manifest
adding: p1/sa.class(in = 687) (out= 423)(deflated 38%)
adding: p1/sb.class(in = 185) (out= 153)(deflated 17%)
Z:\javath>javac demopack.java
demopack.java:4: cannot access sb
bad class file: .\sb.java
file does not contain class sb
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
public class demopack implements sb
                                 ^
1 error
Z:\javath>------------------------------------------------------------
in demopack.java file i want to access class files which are resides in
jar files
Actually when we are writing import java.io.*;
we can access all the class file from that io package
Same thing i am trying to implement for user defined package
I hope you understand my question
regards

Similar Messages

  • IPod Touch, not detected in Windows or iTunes...

    First of all, hello to everyone...
    i want to say that i read a lot EVERYWHERE about my issue and still i couldnt find a solution...
    the problem is easy, i have a 3rd gen ipod touch, OS 4.2.1 now fully working... but, it's not detected in windows or itunes, as simple as that, and as u all have read in lots of other posts...
    my ipod is now working because i took it to an apple store and they charged it in a MAC and they had no problem at all. the MAC detected the ipod, with all its content and my ipod's name...
    but when i took it home -this has been hapenning since maybe... 5 MONTHS!-, i plug it in my PC and nothing happens...
    ok, first of all, my spec... win vista home premium 64 bits, last version of itunes...
    i tried ALL the solutions provided in APPLE official support page, and nothing happens... that means:
    1- completely uninstall itunes and then reinstalling it... i ALSO FORMATED my entire hard drive twice!!!!
    2- tried all USB ports and even an entirely different PC and nothing happened
    3- bought 3 different IPOD to USB cables and nothing happened
    4- tried setting ipod to restore, that way itunes SOMETIMES detected the ipod but i coulnt restore because of different error codes, so i had to take it several times to apple store to "unblock" it...
    the only way it works -detection and charge- is with MAC computers or dock systems such as an iHome my gf has thats the way im charging it now, but otherwise it wont work...
    i would really appreciate any help, since idont know what else to do!!
    thx in advance!!

    HI I was having some other problems getting my itouch to restore because it was not being recognized in itunes and kept erroring out. Now it has finally restored after I updated all kinds of drivers and removed and reinstalled itunes and apple software a million times,(yes this is all after installing itunes 8.1 and paying for an itouch upgrade as well) Now itunes says it cannot do anything with the ipod because it is getting an invalid response from the device. So it won't put anything back on my itouch or even show that I have plugged it in. I emailed tech support, If I find anything out I'll let you know, will you do the same for me?

  • My Iphone 5 is not detected in window 8.1

    My Iphone is not detected in windows 8.1, what is the reason?

    Camera roll to pc, no portable device anymore

  • Connected usb driver is not detected in window 8.1

    hey .....
     HP 250 G3 notebook
    connected usb driver is not detected in window 8.1 after update BIOS software ....my current BIOS software version  F.22 .... so plsss...fix this problem......

    @jeet2113 
    ‎Thank you for using HP Support Forum. I have brought your issue to the appropriate team within HP. They will likely request information from you in order to look up your case details or product serial number. Please look for a private message from an identified HP contact. Additionally, keep in mind not to publicly post ( serial numbers and case details).
    If you are unfamiliar with the Forum's private messaging please click here to learn more.
    Thank you,
    Omar
    I Work for HP

  • Jar file is not being creating

    Dear Members,
    My problem is that: I am using a serialized class in my project.( i.e. I created another project, I made up a serialized class in this this project And I compiled this project. Later I added this project to my actual/first project' s library folder for using this seralized class.) After I disposed my actual project. I builded it for creating a jar file. But any jar file is not falling out (I am using NetBeans) Could you help me please to solve this problem?
    Thank you for taking the time...
    Regards,

    Dear Members,
    My problem is that: I am using a serialized class in my project.( i.e. I created another project, I made up a serialized class in this this project And I compiled this project. Later I added this project to my actual/first project' s library folder for using this seralized class.) After I disposed my actual project. I builded it for creating a jar file. But any jar file is not falling out (I am using NetBeans) Could you help me please to solve this problem?
    Thank you for taking the time...
    Regards,

  • IPod not detected by Windows or iTunes!!

    I bought a new iPod Video days ago but it's not detected by Windows/iTunes!!
    However, it worked when I connected my old ipod mini...
    Any reply would be appreciated.

    hi,
    try the following article my friend...it will definitely resolve your problem..
    http://docs.info.apple.com/article.html?artnum=302420
    http://docs.info.apple.com/article.html?artnum=61711
    Regards,
    Sam

  • JAR file does not get uploaded to client for my SERVLET generated APPLET

    Some help please...
    I have a servlet that generates the HTML code that contains an APPLET. This APPLET needs a JAR file that is listed under its ARCHIVE property. The SERVLET is in a JAR file that is in the same directory as the other needed JAR file. If I create a static HTML with the output of the SERVLET it works fine. But if go through Weblogic the needed JAR file does not get uploaded to the client so I get a java.lang.NoClassDefFoundError:and my APPLET does not load.
    Q1: I am not sure what to put under the CODEBASE tag. I tried "." and I also tried "http://mymachine" but both did not work. I also tried without the CODEBASE tag. No luck. The SERVLET is bound to http://mymachine/servlet.
    Q2: Does anyone have any suggestions on how to do this? Is there a way to force the browser to upload a certain JAR file?
    Thanks...

    It works!!
    This is what I did:
    The jar file in question was the weblogic.jar. I tried putting it under the lib directory of my war file but I had problems because the weblogic.jar contains other war files inside so when I tried to deploy my war file it also tried to deploy the inner war files which for some reason did not work. So I tried removing the war files from the weblogic.jar and this time I had no problems deploying my war file but I still could not find the classes I needed. So I tried moving the weblogic.jar to the root dir of my war file and it worked!! Now the trick here was: I did not set the CODEBASE AND I had the ARCHIVE paramenter set in TWO places like below:
    <APPLET CODE = "marketmap.client.MarketMapApplet"
    ARCHIVE = "weblogic.jar"
    WIDTH = "657"
    HEIGHT = "382"
    ALIGN = "BOTTOM"
    ALT = "APPLET tag not recognized">
    </XMP>
    <PARAM NAME = CODE VALUE = "MyApplet" >
    <PARAM NAME = "type" VALUE="application/x-java-applet;version=1.2.2">
    <PARAM NAME = "scriptable" VALUE="false">
    <PARAM NAME = ARCHIVE VALUE="weblogic.jar">
    </APPLET>
    Actually if you do not place a parameter named ARCHIVE (at the end) it wil NOT work. I tried with multiple jar files listed and it works great too.
    Anyway I figure I'd share. Thanks for the help too.
    Lastly for people who choose not to upload the jar files to clients, you should look at the bea documentation on applets. It lists a classpath servlet that allows you to provide classes to the clients without having to force them to download the jar file.

  • Pdf files wil not open under Windows Live Mail

    PDF Files will not open in WIndows Live Mail. I deinstalled Adobe Reader and reinstalled a more recent version but to no avail. It will open very well using WIndows explorer or when opening the reader. Any clues someone?

    WLM is version 2009 14.0.8117.0416. I'm running under Vista and all other more recent versions are not compatible. The file association has been made and I can open all pdf files in Windows explorer. Under Outlook mail it works as well. It worked until recently when I loaded a program that was supposed to convert pdf files to Word but that did not work so I had to deinstall it and redo the file association. It worked everywher except in WLM.

  • The Apache axis2 jar files are not taking at run time

    While running the application I was getting the following errors. The error is getting at run time only. It has compiled successfully.
    It ran under eclipse without any issues. But with Apache axis we are getting following error trace while uploading to server. The Apache axis2 jar files are not taking at run time.But compiling successfully.
    The application is running under Oracle R12 server.I didn't find any option to set class path for run time in R12 server.
    Using Java version is 1.6 and Apache axis2.1.6.2
    Error trace:
    Exception :java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis2.description.AxisService
    Error : java.lang.NoClassDefFoundError: Could not initialize class org.apache.axis2.description.AxisService
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.populateAxisService(RightNowSyncServiceStub.java:41)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:636)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:625)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:673)
    com.rightnow.ws.wsdl.RightNowSyncServiceStub.(RightNowSyncServiceStub.java:665)
    com.rightnow.ws.util.ContactUtils.initializeService(ContactUtils.java:57)
    somejsp.jspService(_somejsp.java:189)
    com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
    oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:473)
    oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
    oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
    com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
    oracle.apps.jtf.base.session.ReleaseResFilter.doFilter(ReleaseResFilter.java:26)
    com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
    oracle.apps.fnd.security.AppsServletFilter.doFilter(AppsServletFilter.java:318)
    com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:642)
    com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391)
    com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908)
    com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458)
    com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:313)
    com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:199)
    oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
    com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
    java.lang.Thread.run(Thread.java:619)

    Hello,
    I too am trying to use Axis2 application in R12. But getting the following error:
    java.lang.classCastException: com.sun.xml.messaging.saaj.soap.ver1_1.SoapMessageFactory1_1Impl cannot be cast to oracle.webservices.soap.VersionedMessageFactory
    If I run the application standalone from java command line it works fine. I think the error could be because of some oracle app jars getting picked up inatead of my application jars. How to make sure that my application jars get picked up instead of oracle jars
    I tried loading my jar file and then setting it as contextClassLoader using "Thread.currentThread().setContextClassLoader", but this did not help.
    Can you please let me know what can be tried to fix this
    Thanks
    Srikanth

  • Airplay not detected in windows 7 itunes.

    Airplay not detected on windows itunes even after windows update. Security & windows firewall not an issue. Please assist in re-installing the airplay option in my windows 7 itunes.

    I, too, have the same problem. I have read multiple posts, but nothing works. It all began with an iTunes update. Airplay, my ATV, home sharing, and Apple Remote all worked. Now, everything that is dependent on iTunes does not work.
    They are all on the same network.  I have checked it and changed it multiple times. My ATV retrieves photos from my Win 7 HP computer fine, but iTunes might as well not exist. The ATV won't see iTunes through home sharing. None of my AirPlay devices are recognized by iTunes. There isn't even the icon. Remote doesn't recognize the iTunes library either.
    I have reinstalled iTunes several times. Shut down and restarted everything several times. On two occasions, it all worked for a short time, so I know it can work. But I can't replicate that, no matter what I do.
    I have disabled Norton security (and updated it). No difference. I shouldn't have to remove it since it all worked before the iTunes update. That's why I believe it is an iTunes issue. It once worked. Everything else works.

  • When I click on some songs in my itunes library it says the file is not detected.  If i hook up my ipod will i loose the songs already on it or will it retore the files to itunes?

    When I click on some songs in my itunes library it says the file is not detected.  If i hook up my ipod will i loose the songs already on it or will it retore the files to itunes?

    Before to attach your ipod.... try to find the file where you put your music.... click on that song.... itunes will ask you if you want to locate it.... from there you have to find the song(s) that is one of the folders in your PC.
    http://support.apple.com/kb/TS1408

  • HP pen drive v165w not detected in windows 7

    HP pen drive v165w not detected in windows 7 after using for 4 months. plsee help

    How old is the desktop? Versions of Windows XP before SP2 did not recognize usb mass storage devices such as the pen drive. Also, do the usb ports generally work? Have you tried all the usb ports on the desktop?

  • HP x720w 64GB Pen Driver Does not detect on Windows 7 Laptop

    HP x720w 64GB Pen Driver Does not detect on Windows 7 Laptop. While it detects on my PC. Same OS. Pls advise.

    I will have to wait until a Moderator inspects your image and makes it viewable.
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • HP pen drive v165w not detected in windows XP

    HP pen drive v165w not detected in windows XP, please help

    How old is the desktop? Versions of Windows XP before SP2 did not recognize usb mass storage devices such as the pen drive. Also, do the usb ports generally work? Have you tried all the usb ports on the desktop?

  • .jar file suddenly not working

    I have some minimal experience working with .jar files, but I am baffled here.
    Recently, the jar file for one of my programs stopped working. I had just made a change to my main class, so i repackaged the jar. Now it says "Can't find main class" when I try to run it. It will only work if I add the line
    Class-Path: . (there is a period there)
    to my manifest.
    This would be fine, but I want to use exe4j to make it into a Windows executable. exe4j must do something where it does not honor the mainifest settings, because the executable gives out a "can't find main class" error no matter what.
    What has happened? It is only an issue with this program, i have repackaged several others to test, and they work without the "Class-Path" workaround. I'm pretty sure that it's not something in the nature of the program itself, because it worked eariler, and my only change was a small one (the text of a few JLabels).
    I have made sure that my main class is in the root of my jar file, and I have the Main-Class attribute correctly set in my manifest. The program runs fine outside the jar, but displays this odd behavior only when "jarred".
    Any help would be greatly appreciated.

    also, it's only the one class that's affected.
    I tried setting the Main-Class to other classes in the jar, and that worked fine. When I tried to make a workaround, making one of the other classes' main call the one I wanted, i got a "fatal exception" error. I'm pretty sure it still couldn't find the file.

Maybe you are looking for

  • Enterprise Voice and Lync Meeting Outlook Add-In, Dial in Numbers

    I ran across something that I was unaware of and wanted to double check here.  Background:  I am running a two pool Lync 2013 Enterprise Deployment with an OCS pool being phased out.  All users are migrated to Lync backend using the OCS client but ou

  • Converted VM running on Hyper-V keeps loggin Event ID 1000, 257, 259

    After converting a VM running Windows 2008 r2 from VMware to Hyper-V, we receive event ID 1000 and 7031 as listed below. Log Name:      System Source:        Service Control Manager Date:          3/7/2014 2:24:58 PM Event ID:      7031 Task Category

  • Any way to connect a webcam? USB?

    Has anyone figured out how to connect a webcam (and Skype)?

  • Album Artwork - Where did the volume and song title go?

    I've been searching online for hours and can't find this on my own so i'm reachin out... I did a software update (which i won't ever do again) and now when a song is playing the cover art (or a big empty box if i remove cover art) is all that shows o

  • Strange Font issue - Adobe reader

    Hi All, First off - Thank you for your help. I have a strange issue with Adobe Reader where the font is not correctly displayed correctly as compared to the original document. Document diplays in a strange font as per attachment. I have removed and r