Java Default FileSystem Root.

If I want to program file System specifiers in a platform generic way in java, I call
System.getProperty("file.separator");
So I know the correct version of slash to use, wherever my program is run.
On Unix, the root of the file system is /
windows, the root is c: by default.
What is the platform independent way to specify or enquire after the
file system root specifier applicable, irrespective of the Operating System
that the present Java program and JVM is on?

>
What is the platform independent way to specify or enquire after the
file system root specifier applicable, irrespective of the Operating System
that the present Java program and JVM is on?
>
It is not clear what information you need or what you are trying to do.
Can you provide an example of the information you want and how you plan to use it?
Have you looked at the listRoots() method of the File class? That method will return the available roots. If the roots start with a slash you know that they aren't windows.
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html
>
The prefix concept is used to handle root directories on UNIX platforms, and drive specifiers, root directories and UNC pathnames on Microsoft Windows platforms, as follows:
•For UNIX platforms, the prefix of an absolute pathname is always "/". Relative pathnames have no prefix. The abstract pathname denoting the root directory has the prefix "/" and an empty name sequence.
•For Microsoft Windows platforms, the prefix of a pathname that contains a drive specifier consists of the drive letter followed by ":" and possibly followed by "\" if the pathname is absolute. The prefix of a UNC pathname is "\\"; the hostname and the share name are the first two names in the name sequence. A relative pathname that does not specify a drive has no prefix.

Similar Messages

  • Looking for the java default XML parser?

    Hey guys,
    I just wondering alot about the sometimes mentioned Java Default XML Parser. So I used xerces and it worked fine, but my program doesnt need the whole functionality of xerces and I want to save some space for the resulting project jar. The xerces parser is 1.1 MB huge and instead of xerces I could use the default SAX parser in the java API, I thought.
    Although it is mentioned in some books/documents I can not find it.
    Could you give me an exmaple with the XMLReaderFactory how to use the default parser?
    I would appreciate this alot!
    Thanks.

    Hey,
    yes that I tried before, because I read this too.. If I am doing this Im getting the error:
    Exception in thread "main" org.xml.sax.SAXException: System property org.xml.sax.driver not specified
         at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:90)
         at cfm.com.gui.GUIBuilder.buildGUIPage(GUIBuilder.java:51)
    ...So, this means that the JDK comes not with an default parser implementation I suggest.
    Hmm... stupid! I think I have to ship the xerces parser with my application... but its huge!
    Does anybody know what of the compelling parser are the lighweightest?
    Im gonna look for this answer too....
    Thanks.

  • Deploy war app with correct default context root

    Hi
    Am using Weblogic 9.2 Appserver.
    When I deploy a war file, I see that the war is exploded in ...domains/domain1/servers/<server-name>/tmp/_WL_user/<application-name>/<random-string>/war/.
    I would like that when I deploy the war app, WL pick up the context root from the name of the webarchive.
    At present this is not happening, and WL uses as default context root the name of the folder that holds the contents of the exploded archive.
    This is the case, even when I go with the no staging option, i.e. specify that the source not be copied and will be available from a specific location. WL still explodes the archive in the above-mentioned dir, and uses "war" as the default context.
    How can I get around this ?

    I'm closing this post.
    What I really wanted to ask is at http://forums.bea.com/bea/thread.jspa?forumID=2017&threadID=400004071 .

  • ColdFusion 9 change Java Default Locale ?

    I keep getting en error with
    en_MY must be one of the ColdFusion supported locales.
    The list of supported locales is stored in the variable Server.ColdFusion.SupportedLocales.
    The error occurred in E:\wamp\www\Test2\test.cfm: line 2
    1 : <cfform>
    2 : <cfinput type="datefield" name="test" value="dasd">
    3 : </cfform>
    I check my jvm detail, my java default locate is showing en_MY.
    I have try few way also can't solve my problem
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-6d 90.html
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24 -67f2.html
    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7f a3.html
    After i complete setting with the intruction from the link , i try restart computer. but the java default locate still being same.

    Thank you.
    Currently I am using ColdFusion 9 and with multiserver.
    I could not found the jvm argument w/ "-Duser.language" or  "-Duser.region"
    In my jvm.config, i only found this is similar
    # Arguments to VM
    java.args=-server -Xmx512m -Dsun.io.useCanonCaches=false -XX:MaxPermSize=192m -XX:+UseParallelGC -Dcoldfusion.rootDir={application.home}/
    I saw there is another file call wsconfig_jvm.config , but cant found it , the simiar is
    java.args=-Xms32m -Xmx128m
    # java.class.path - use this for adding individual jars or
    # directories.  When directories are included they will be searched
    # for jars and zips and they will be added to the classpath (in
    # addition to the directory itself), the jar to be used in launching
    # will be appended to this classpath

  • Return custom java.io.FileSystem through getFileSystem()

    Hello world!
    The method java.io.FileSystem->getFileSystem, which is native, returns an instance of a java.io.Win32FileSystem on my win2k box. I want it to return a java.io.MyCustomFileSystem instead. How do I do this? Is there some JVM configuration setting (parameter or conf-file) like "FileSystem=java.io.Win32FileSystem"?
    I need my java-program to be able to find some files using relative paths in for example the File() constructor, where the files are in directories only known at run-time. I want to do this through a custom FileSystem, without hacking any java classes.
    Nicolai Gr�dum

    -Create your own jvm.
    -Override java.io.FileSystem. Copy that class (and C
    code.) Modify it to do what you want. Create a dll.
    Modify java code to load that dll. Then use the
    Xbootclasspath command line option for java to load
    your class.Thanks, but I am looking for a method that isn't too much of a "hack".
    If I want to "hack", I don't need to create a dll, I can simply change the method getFileSystem() in java.io.FileSystem to not be native and give it a body returning an instance of java.io.MyFileSystem, which can extend Win32FileSystem, which in turn does all the native handling. I would then add these two classes to the Xbootclasspath or put them into my rt.jar, overwriting java.io.FileSystem.
    Nico.

  • Unionfs-fuse as filesystem root

    I currently have Arch booted over iscsi, i want to use it in read-only mode (so multiple users can use it simultaneously) with read-write unionfs stored in RAM (tmpfs).
    Currently i have this script:
    #!/bin/sh
    # Copyright: Bernd Schubert <[email protected]>
    # BSD license, see LICENSE file for details
    FUSE_OPT="-o allow_other,use_ino,suid,dev,nonempty"
    CHROOT_PATH="/.unionfs"
    UNION_OPT="-ocow,chroot=$CHROOT_PATH,max_files=32768"
    # 2/3 wolnego RAM'u
    TMPFS_SIZE=`free -m | grep Mem: | awk '{ printf "%d\n", $4 * 2 / 3 }'`
    UBIN=/usr/bin/unionfs
    mount -t proc proc /proc
    # mount -t tmpfs tmpfs /tmp '`
    mount -t tmpfs -o size=${TMPFS_SIZE}M,rw tmpfs /.unionfs
    mkdir -p $CHROOT_PATH/root
    mkdir -p $CHROOT_PATH/rw
    mkdir -p $CHROOT_PATH/union
    mount --bind / $CHROOT_PATH/root
    $UBIN $FUSE_OPT $UNION_OPT /rw=RW:/root=RO $CHROOT_PATH/union
    mount -t proc proc $CHROOT_PATH/union/proc
    cd $CHROOT_PATH/union
    mkdir oldroot
    pivot_root . oldroot
    # init q
    I'm pretty sure script itself is ok (when i simply execute it in working system, everything works properly except 'pivot_root').
    I have no idea how to properly invoke it during system boot with systemd.
    Last edited by drag0nius (2013-06-25 16:39:29)

    jac wrote:
    @Caveman85de: I don't think that's what synthead meant
    I don't know of a way, but will faking that with chroot help you? (I use "fake" here because I don't actually know enough about chroot to tell you something more specific...)
    Interesting ... yeah.  This would be on a production environment, so I don't think a chroot would suffice, but that's definitely something to consider.
    I'm thinking I could so something like this.  I would create a very small partition somehow, perhaps loopbacked to a file.  This would have all the directory structures needed in the new filesystem as well as other directories to mount the old filesystem partitions.  I could call this .oldroot.  I would create .newroot in every partition too, then use binds to "mount" the new folders in the partitions where the old ones used to be.
    newroot.img / udf defaults,loop 0 0
    /dev/sda1 /.oldroot ext3 defaults 0 1
    /.oldroot/.newroot / none bind 0 0
    Again, proof of concept ...

  • What is the Java default ORB implementation class?

    I have a web application deployed on the Sun Java System Application Server 8. This application will also act as a CORBA client by invoking remote methods on another CORBA server.
    Our first approach was to use the ORB provided by the Sun App Server. But whenever the code reaches the point to initialize the ORB:
    orb = ORB.init(as, null); we encountered such exceptions:
    [#|2005-02-03T00:38:43.912-0600|WARNING|sun-appserver-pe8.0.0_01|javax.enterpris
    e.resource.corba._DEFAULT_.rpc.transport|_ThreadID=14;|"IOP00710209: (INTERNAL)
    Unable to create listener thread on the specific port"                         
    org.omg.CORBA.INTERNAL:   vmcid: SUN  minor code: 209  completed: No  
    at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFa
    iled(ORBUtilSystemException.java:3142)                                         
            at com.sun.corba.ee.impl.logging.ORBUtilSystemException.createListenerFa
    iled(ORBUtilSystemException.java:3160)     When we deployed the same app on Tomcat, it worked fine. We later reasoned the exception was happening on the Sun App Server because perhaps it was trying to initialize another ORB with the same properties as the one initialized by the Sun App Server, and thus was trying to create another listener on a port already in use.
    On tomcat, the ORB used was the default ORB provided by Java. Thus, we thought we would try 'overriding' the ORB properties for the Sun App Server by specifiying this in the ORB.init() method:
            String as[] = null;
         Properties orbProperties = new Properties();
         orbProperties.put("org.omg.CORBA.ORBClass","com.sun.corba.se.internal.iiop.ORB");
         orbProperties.put("org.omg.CORBA.ORBSingletonClass","com.sun.corba.se.internal.iiop.ORB");
            orb = ORB.init(as, orbProperties);But when executing this, we get the exception as follows:
    Caused by: org.omg.CORBA.INITIALIZE: can't instantiate custom socket factory: co
    m.sun.enterprise.iiop.IIOPSSLSocketFactory  vmcid: 0x0  minor code: 0  completed
    : No                                                                           
            at com.sun.corba.se.internal.corba.ORB.parseProperties(ORB.java:1250)  
            at com.sun.corba.se.internal.POA.POAORB.parseProperties(POAORB.java:267)
            at com.sun.corba.se.internal.Interceptors.PIORB.parseProperties(PIORB.ja
    va:341)                                                                        
            at com.sun.corba.se.internal.corba.ORB.set_parameters(ORB.java:460)    
            at com.sun.corba.se.internal.POA.POAORB.set_parameters(POAORB.java:153)
            at com.sun.corba.se.internal.Interceptors.PIORB.set_parameters(PIORB.jav
    a:333)                                                                         
            at org.omg.CORBA.ORB.init(ORB.java:337)                                
            at com.covansys.ipceuc.corbalogic.SessionManager.<clinit>(SessionManager
    .java:159)      Some Sun sites mentioned that com.sun.CORBA.iiop.ORB is the Java ORB implementation. When trying to use this, we got a ClassNotFoundException.
    Also tried the following classes:
    com.sun.corba.se.internal.corba.ORB
    com.sun.corba.se.internal.core.ORB
    com.sun.corba.se.internal.org.omg.ORBAll of them reported exceptions as follows:
    Caused by: org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementati
    n org.omg.CORBA.ORB  vmcid: 0x0  minor code: 0  completed: No                 
            at org.omg.CORBA.ORB.create_impl(ORB.java:297)                        
            at org.omg.CORBA.ORB.init(ORB.java:336)                               
            at com.covansys.ipceuc.corbalogic.SessionManager.<clinit>(SessionManage
    .java:158)                                                                    
            ... 55 more                                                           
    Caused by: java.lang.InstantiationException                                   
            at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstanc
    (InstantiationExceptionConstructorAccessorImpl.java:30)                       
            at java.lang.reflect.Constructor.newInstance(Constructor.java:274)    
            at java.lang.Class.newInstance0(Class.java:308)                       
            at java.lang.Class.newInstance(Class.java:261)                        
            at org.omg.CORBA.ORB.create_impl(ORB.java:295)                        
            ... 57 more                                                           
    |#]                                                                            Anyone know what the Java ORB implementation class is, or whether this is possible at all?
    Thanks in advance.

    Hello
    The defaults for JDK 1.4.2 (at least) are shown it the code below:
            Properties p = new Properties ();
            p.put ("org.omg.CORBA.ORBSingletonClass",
                   "com.sun.corba.se.internal.corba.ORBSingleton");
            p.put ("org.omg.CORBA.ORBClass",
                   "com.sun.corba.se.internal.Interceptors.PIORB");
            p.put ("javax.rmi.CORBA.UtilClass",
                   "com.sun.corba.se.internal.POA.ShutdownUtilDelegate");
            p.put ("javax.rmi.CORBA.PortableRemoteObjectClass",
                   "com.sun.corba.se.internal.javax.rmi.PortableRemoteObject");
            System.setProperties (p);Of course you can use this code to set these defaults back. Be careful, if you do this inside Weblogic, for instance, it will likely abend.
    []'s
    Marcond

  • Windows FTP download to ASA, default password = root

    I was able to set up a Windows 2003 server as an FTP server, and was able to transfer files.  However, I had to view the Windows FTP log to determine the default password was root@DallasRouter.   I can not find any documentation on this, and it's the first time I've seen "root" in the Cisco world.   Can anyone point me to a web site or help me understand this?                  

    Jimmyc,
    On the ASA you can include the any userID as part of the ftp URL like this one below
    KUSANKAR-ASA-5505# copy ftp://kusankar:[email protected]/asa.txt flash:asa.tx                        t
    Address or name of remote host [192.168.2.2]?
    Source username [kusankar]?
    Source password [kusankar]?
    Source filename [asa.txt]?
    Destination filename [asa.txt]?
    Accessing ftp://kusankar:[email protected]/asa.txt...!!!!!!!!!!!!!!!!!!!!!!!!                        !!!!!!!!!!!!!!!!!!
    Writing file disk0:/asa.txt...
    56097 bytes copied in 0.140 secs
    KUSANKAR-ASA-5505#
    http://www.cisco.com/en/US/docs/security/asa/asa84/command/reference/c4.html#wp2171368
    -Kureli

  • Java default encoding

    Hi everybody.
    Which is the default encoding used in java ?
    Thank's for answering.

    Yes, there is one:
    "Every instance of the Java virtual machine has a default charset, which may or may not be one of the standard charsets. The default charset is determined during virtual-machine startup and typically depends upon the locale and charset being used by the underlying operating system."
    If you want to know it all refer to the javadoc api documentation on Charset class:
    http://java.sun.com/j2se/1.4.2/docs/api/java/nio/charset/Charset.html
    May the code be with you.

  • Java ssl and root certificate

    We use JAVA as a client for secure SSL connection. For this is a SSL root certificate necessary, if not, the SSL handshake fails due the trust relationship.
    SUN introduced the feature in version 1.5, that JAVA can use OS keystore and grab ROOT certificate from there.
    Unfortunately, this is not working anymore with JAVA 1.6 and if the ROOT is not present in JAVA keystore, the SSL handsake fails. Once the ROOT is imported in JAVA keystore, the SSL works fine. SUN JAVA 1.5 works fine with same environment and ROOT does not need to be in JAVA keystore.
    The failed SSL handsake is visible in Ethereal Sniffing log and is always reproducible.
    Please, are there known issues, that SUN JAVA 1.6.x can not use OS keystore, but only JAVA keystore ? Are there any reported bugs ?

    Right.  Hopefully you've gotten acquainted with this:
    http://technet.microsoft.com/en-us/library/ee126140(v=ws.10).aspx
    Is the CA on the DC also issuing certs, or is it just the Enterprise Root and there are subordinates issuing certs?  I ask because if it's just the Enterprise Root but not actually issuing certs, that simplifies things greatly.  If it's issuing
    certs, one thing to research is what certs are currently issued, how often they are renewed, and what they are used for.  This will give you an idea how much risk you're looking at during cutover. 
    To address the specific question of what happens to a desktop that has been offline during the cutover, as I understand it the desktop will pull the new PKI information (new AIA path, new CDP if that gets changed) from AD when it comes back online. 
    This data is stored in "CN=Public Key Services,CN=Services,CN=Configuration,DC=Domain,DC=COM" in AD.  In a nutshell, it should be seamless to that particular client.

  • Default Java Charset

    Hello:
    I have a problem sending mail from a web application; when it's run from my desktop it sends mail OK, but when it's run from the server it sends messages with accents ant other signs garbled (in the body and in the Subject line).
    I've been investigating and saw that the difference between the same message sent from the two machines is that one is encoded with "quoted-printable" when the other is "7bit". After more investigations I think I compose the mail correctly, but then I used "MimeUtility.getDefaultJavaCharset()" and discovered that my machine gets "ISO-8859-15" while the server gets "US-ASCII". Both are linux machines, and they have the "es_ES@euro" locale set. I've discarded too the encoding of the text file from which I get the text of the body, because I test always with three files (they have the same content, but one is encoded in UTF8, other in ISO-8859-1 and the other in ISO-8859-15).
    So the problem seems to me that is reading the file; if JVM in the server runs in US-ASCII meybe it can't read the file correctly, so it won't get correctly encoded in the mail no matter what I do.
    The question is: How can I change the Java Default Charset in the server? Or, how can I read the file correctly no matter what the Java Default Charset is?
    Thank you in advance.

    Well, at least I can send now the text correctly encoded, although it now encodes it with "base64" instead of "quoted-printable", which is what I intended... Anyway, here's the code I use to read the text file forcing the charset:
    BufferedReader lectorFichero=new BufferedReader(new InputStreamReader(new FileInputStream(nombreFichero),"ISO-8859-15"));
    StringBuffer bufferTextoFichero=new StringBuffer();
    int i;
    while((i=lectorFichero.read())!=-1) bufferTextoFichero.append((char)i);
    lectorFichero.close();
    String textoFichero=bufferTextoFichero.toString();(Thanks to Dr. Heinz M. Kabutz; http://www.roseindia.net/javatutorials/using_unicode_variable_names.shtml)

  • How to make 64-bit JVM default on Solaris 10

    Hi,
    I am running my application on Solaris 10. Currently, my application uses JRE 1.6 32-bit version. I am trying to make it work with JRE 1.6 64-bit version. I successfully installed 64-bit java using the instructions here: [http://www.java.com/en/download/help/5000011500.xml] and am able to invoke 64-bit java using either $JAVA_HOME/bin/java -d64 or by using $JAVA_HOME/bin/sparcv9/java.
    My application always invokes the java executable under *$JAVA_HOME/bin*. By default, this is invoking the java 32-bit version which I do not want. Of course, I could add the -d64 option to all calls to java in my application. However, I do not want to do that as java is being called from a number of scripts and some scripts are also being shared between multiple platforms.
    How do I make the 64-bit java the default? I tried copying over the java executable from under *$JAVA_HOME/bin/sparcv9* to *$JAVA_HOME/bin*. This seems to invokes the java 64-bit version correctly from within my application. However I do not know if this is the right thing to do or if it has adverse side effects.
    Any help/inputs will be greatly appreciated!
    Thank you so much.

    So, it may be better to create links in $APP_HOME/bin/java that point to the binaries in /usr/jdk/version-you-want-to-use/bin/sparcv9 rather than copying binaries.
    To see current java links: (I edited all non-java-related links out of listing)
    -> ls -la /usr/bin/j*
    lrwxrwxrwx 1 root other 15 Oct 1 2007 /usr/bin/jar -> ../java/bin/jar
    lrwxrwxrwx 1 root other 21 Oct 1 2007 /usr/bin/jarsigner -> ../java/bin/jarsigner
    lrwxrwxrwx 1 root other 16 Oct 29 2007 /usr/bin/java -> ../java/bin/java
    lrwxrwxrwx 1 root other 17 Oct 1 2007 /usr/bin/javac -> ../java/bin/javac
    lrwxrwxrwx 1 root other 19 Oct 1 2007 /usr/bin/javadoc -> ../java/bin/javadoc
    lrwxrwxrwx 1 root other 17 Oct 1 2007 /usr/bin/javah -> ../java/bin/javah
    lrwxrwxrwx 1 root other 17 Oct 1 2007 /usr/bin/javap -> ../java/bin/javap
    lrwxrwxrwx 1 root other 18 Oct 29 2007 /usr/bin/javaws -> ../java/bin/javaws
    lrwxrwxrwx 1 root other 24 Oct 29 2007 /usr/bin/jcontrol -> ../java/jre/bin/jcontrol
    lrwxrwxrwx 1 root other 15 Oct 1 2007 /usr/bin/jdb -> ../java/bin/jdb
    lrwxrwxrwx 1 root root 30 Oct 1 2007 /usr/bin/jmplay -> ../jdk/packages/jmf/bin/jmp
    lay
    lrwxrwxrwx 1 root root 50 Oct 1 2007 /usr/bin/jnlp2pkg -> ../jdk/packages/org.jdesk
    top.jdic-0.8/bin/jnlp2pkg
    lrwxrwxrwx 1 root root 13 Oct 1 2007 /usr/bin/jsh -> ../../sbin/sh
    BTW, on my machine (SunFire v445, Solaris10, 64-bit)
    isainfo -v produces this:
    -> isainfo -v
    64-bit sparcv9 applications
    vis2 vis
    32-bit sparc applications
    vis2 vis v8plus div32 mul32
    So, what will this do for me?
    or even better $(JAVA_HOME)/bin/`isainfo -v`/Edited by: SolarisSAinPA on Jun 12, 2008 5:38 PM
    Added listing of java-related-links

  • Package NOT accessible outside parent/root directory - NoClassDefFoundError

    I can't seem to import a package I created, EXCEPT UNDER THE TOP LEVEL
    PARENT DIRECTORY. The following chronicles what I attempted. I read, and
    tried related postings in this newsgroup, but they have not totally
    solved my problems.
    /* d:\java\zsamples\zswingpackage1\swing-optgrp-eg1.java
    /* Following package stmts. causing run-time error "Exception in thread
    "main" java.lang.NoClassDefFoundError: zswingpackage1/Swing
    OptGroup1a [(wrong name: java/zsamples/zswingpackage1/SwingOptGroup1a)]".
    Solution: as suggested in newsgroup posting, changed package stmt. to
    include ONLY the SUBDIRECTORIES UNDERNEATH the top level 'java'
    directory (EXCLUDE 'java.' qualifier from package stmt.). Compiled from
    the parent directory of the package path, and also ran from that path
    i.e.
    package zsamples.zswingpackage1;     // omits the top level 'java' directory
    public class swing_optgrp_eg1 extends JFrame {
    Here's how I compiled:
         cd java
         d:\java>javac zsamples\zswingpackage1\swing_optgrp_eg1.java
    Here's how I executed:
         Following WORKED. Uses '.' aot backslash qualifier.
         D:\java>java zsamples.zswingpackage1.swing_optgrp_eg1
         Above package defn. solution allowed a calling program (residing under
         the top level 'java' directory) to successfully import the package
         (refer \java\test-package2.java)!! But having difficulties in importing
         this package when referenced in a calling program RESIDING IN A DEEPER
         LEVEL DIRECTORY, such as d:\java\zsamples (refer package-test1.java).
    Calling program1 (resides under d:\java\package-test2.java): WORKED
         /* This source purposely placed in the 1st level directory to test the
         theory/scenario: is it necessary to store the calling program (that
         accesses my package) in the top level directory (d:\java)? */
         import zsamples.zswingpackage1.swing_optgrp_eg1;     // resides under d:\java
    Calling program2 (resides under d:\java\zsamples\package-test1.java): DID NOT WORK
         /* Following import causing "package zsamples.zswingpackage1 does not exist"
              COMPILE ERROR. But worked in package-test2.java.
         Solution (wasn't necessary in package-test2.java):
              - specified 'java' in classpath i.e.          
                   d:\java\zsamples>javac package-test1.java -classpath .;d:\java
              But subsequently, when RUNNING using D:\java\zsamples>java Package_Test1,
              caused RUN-TIME error "Exception in thread "main" java.lang.NoClassDefFoundError:
              zsamples/zswingpackag e1/swing_optgrp_eg1".
              import zsamples.zswingpackage1.swing_optgrp_eg1;     // resides under d:\java
         /* Unsuccessful remedies:
         1) use -classpath with compiler i.e.
              d:\java\zsamples>javac package-test1.java -classpath .;d:\java\zsamples\zswingpackage1
         2) removed top level 'zsamples' qualifier in package name, compiled
              with, and without -classpath parm. i.e.
              import zswingpackage1.swing_optgrp_eg1;     // resides under d:\java\zsamples
              This caused "cannot access zswingpackage1.swing_optgrp_eg1 bad class
              file: .\zswingpackage1\swing_optgrp_eg1.class class file contains wrong
              class: zsamples.zswingpackage1.swing_optgrp_eg1 Please remove or make
              sure it appears in the correct subdirectory of the classpath."
         3) added top level 'java.' qualifier in package name, compiled with, and
              without -classpath parm. i.e.
              import java.zsamples.zswingpackage1.swing_optgrp_eg1;
              This caused "package java.zsamples.zswingpackage1 does not exist".
         4) when running, specified '.;d:\java\zsamples\zswingpackage1', or
              '.;d:\java\zsamples' in -classpath i.e.
                   D:\java\zsamples>java Package_Test1 -classpath .;d:\java\zsamples\zswingpackage1
                   D:\java\zsamples>java Package_Test1 -classpath .;d:\java\zsamples
         // Following import caused same errors as above import stmt.
         //import zsamples.zswingpackage1.*;
         class Package_Test1 {
    My PC configuration:
         java version "1.4.0_01"
         Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0_01-b03)
         Java HotSpot(TM) Client VM (build 1.4.0_01-b03, mixed mode)
         JRun 4 (Build 47304)
         WinNT 4.0 SP5
         IE 5.50
         CLASSPATH=.;D:\jakarta-tomcat-3.3.1\lib\common\servlet.jar;
              C:\JRun4\servers\default\default-ear\default-war\WEB-INF\classes
         JAVA_HOME=C:\j2sdk1.4.0_01
         Path=C:\j2sdk1.4.0_01\bin;C:\WINNT\system32;C:\WINNT;
              C:\Program Files\Network Associates\PGPNT;C:\Program Files\MTS;d:\MSSQL7\BINN

    It's hard for me to follow everything you posted. Perhaps this link will help.
    http://java.sun.com/docs/books/tutorial/java/interpack/packages.html
    Some things to keep in mind. Packages are not directories - they just use the path structure of directories to manage namespaces. No matter where a class is, if your Classpath is d:\java, then the root of any class in a package must be in a directory structure that exists inside d:\java. Also, compilers and the JVM utilize the fully qualified name of a class, meaning the package name plus the class name.

  • Create a browser in a java application

    Hello everybody, I need yor help, I need make a little browser in a java application.
    I have a JComboBox whith filesystem roots like items(I used File ListRoots()), and I need to appear the directories in a Jtree, and I do not know how can I make that, please help me......thanks a lot

    I'm new in java programig this is the first
    application that I do, really I need help...thanksIf you have never written a Java program before then you have chosen a difficult task. What you should do next is: stop asking questions here. You do not understand the answers you are getting because you do not have the background knowledge to understand them. Instead, read those tutorials that you have been referred to. You will not understand them either, but that is normal too. Try the examples they contain. Once you have them working, try changing them to do something else.
    If you need basic Java training, read more of the Java tutorials you will find here:http://java.sun.com/docs/books/tutorial/But remember, you cannot learn Java or any other language by asking people one question at a time.

  • How to re-install Java in Solaris 10

    Dear all,
    Let me first apologize if this is not the most suitable forum to post my enquiry (if so, please let me know which one is!). I have a SUN Blade 1500 Silver running Solaris 10. After some patching via smpatch, the Solaris Management Console stopped working, I believe due to a problem between java 1.5 and SMC (see problem "Can't start smc " at:
    http://forum.sun.com/jive/thread.jspa?threadID=100328&messageID=342909 )
    I tried to make the SMC work by tweaking the java path and links to point the old version (1.4.2), but without any success. Moreover, in a desperate effort to solve the problem, I DELETED all the directories, files and symbolic links relating to java under the directories "/usr" and "/usr/bin" (since I couldn't find on the internet a way to "uninstall" java from the system!), and then I tried to install the java packages available at www.sun.com (JRE, J2EE, etc) by using the .sh executables provided there, but without any success. All these installers seem to only unpack java files to complete different directories from the aforementioned (under the path from which they are run), and none seem to install the files in the original locations from which I deleted files ("/usr" and "/usr/bin", and the like).
    Now, not only does the SMC continue to fail to work, but also any other application requiring java fails to excecute. IS THERE A WAY TO RESTORE THE ORIGINAL JAVA FILES THAT ARE COPIED IN THE SYSTEM WITH THE INSTALLATION OF THE SOLARIS OS??? Please note that I am not interested neither in the java plugin for browsers, nor in developing apps with/for java: I only want my system (SMC, smpatch, etc) and applications (mostly EDA software - Cadence) to run smoothly without receiving errors due to missing java files!
    Thans a lot in advance for any help or clue to overcome this rather unpleasant situation.
    Jorge Luis.

    You should be able to just download the version that contains the Solaris packages and follow the installation instructions to use pkgadd to add those packages.
    [Update: hmm it seems only the JDK is available that way not the JRE. It seems if you don't want to install the JDK (though there is no real reason not to) you'd need to reinstall the original packages from your Solaris install media - and you may need to remove any patches that updated the JRE, first.]
    That said if you deleted some of the links then the package install may not necessarily restore them.
    Here's my setup. Note I manually set the "latest" link. The default was that /usr/java linked to /usr/jdk/jdk1.5.0_07
    hypert > dir /usr/bin/java
    lrwxrwxrwx 1 root other 16 Dec 19 2005 /usr/bin/java -> ../java/bin/java
    hypert > dir /usr/java
    lrwxrwxrwx 1 root root 10 Aug 29 13:11 /usr/java -> jdk/latest
    hypert > dir /usr/jdk
    total 16
    drwxr-xr-x 4 root bin 512 Aug 29 11:30 .
    drwxr-xr-x 40 root sys 1024 Aug 29 13:11 ..
    drwxr-xr-x 4 root bin 512 Aug 29 11:29 instances
    lrwxrwxrwx 1 root other 7 Dec 19 2005 j2sdk1.4.2_08 -> ../j2se
    lrwxrwxrwx 1 root other 18 Jun 2 09:47 jdk1.5.0_07 -> instances/jdk1.5.0
    lrwxrwxrwx 1 root other 18 Aug 29 11:30 jdk1.6.0 -> instances/jdk1.6.0
    lrwxrwxrwx 1 root other 8 Aug 29 11:30 latest -> jdk1.6.0
    drwxr-xr-x 7 root bin 512 Dec 19 2005 packages
    Message was edited by:
    davidholmes

Maybe you are looking for

  • What is the best way to look after Macbook Pro Retina Display battery?

    Hello, I am a little confused on how to look after the battery in my new Macbook Pro with Retina Display. I have read lots of different things and I do not seem to get a clear answer. I feel by charging my laptop all the way, then using till 0% and d

  • New 2600xps...can I upgrade???

    Major newbie question here.... I have the KT3 Ultra ARU.  Wondering if I can upgrade to the new 2600 AMD chips to soon come out. Do I need some sort of BIOS flash to do this, anything else, or does my board just support up to 2200?   TIA :D

  • I need help choosing a cell phone

    Ok. Currently I have an HTC Eris and it has all sorts of bad issues. I have talked with Verizon on the phone, chat, in person for the last several days. They said that I can get a pre-certified phone to replace my Eris and I had been going back and f

  • Publicar app para ios(iphone y ipad) desde Dreamweaver CS5.5

    hola como estan espero que me ayuden con este problema e creado una app para android y una app para iphone, las dos las cree con dreamweaver CS5.5 y con Phonegap. Al publicar la aplicacion de android me genero sin ningun problema el archivo .APK pero

  • JCO Connection Errors

    Hi Experts, we have configured the ECC6.0 backend system in to SLD and tested the same, its succesfully running and configured. next  we tried to create the Jco connection(META DATA and MODEL DATA) for the backend system, it was created with out any