How colon works in java

import java.io.*;
import java.net.*;
import java.util.*;
public class tst {
public static void main(String args[])
throws SocketException {
Enumeration<NetworkInterface> nets =
NetworkInterface.getNetworkInterfaces();
for (NetworkInterface netint : Collections.list(nets)) {
displayInterfaceInformation(netint);
private static void displayInterfaceInformation(
NetworkInterface netint) throws SocketException {
System.out.printf(
"Display name: %s%n", netint.getDisplayName());
System.out.printf("Name: %s%n", netint.getName());
Enumeration<InetAddress> inetAddresses =
netint.getInetAddresses();
for (InetAddress inetAddress : Collections.list(
inetAddresses)) {
System.out.printf("InetAddress: %s%n", inetAddress);
System.out.printf("%n");
WHen I am trying to run this program its giving me following error.. can some one help me to solve this problem ??
C:\j2sdk1.4.2_13\bin>javac tst.java
tst.java:11: ';' expected
for (NetworkInterface netint : Collections.list(nets)) {
^
tst.java:14: illegal start of expression
^
tst.java:23: ';' expected
for (InetAddress inetAddress : Collections.list(
^
tst.java:28: illegal start of expression
^
4 errors
C:\j2sdk1.4.2_13\bin>

Thanks.......
However, is it right to say something odd to someone just becuase of she/he doesn not know somethink.....Pointing out that putting anything under /bin is foolish isn't being "odd", it's the truth.
And yes, I dont know everything that is why I am in this forum!! Believe me, that's clear.
but thanks again bcos u r so polite !!!!
Now, can you explain what is path and classpath..You're screwed if you don't know that. Maybe Google can help you, but here's my best effort:
PATH is an environment variable on Windows and *nix operating systems that tells the OS where to look for executable code.  If you have your PATH set to JAVA_HOME/bin, where JAVA_HOME is the directory where you installed Java, the operating system will look there for .exe files when you open a command shell and type "javac" or "java" or "jar".
CLASSPATH is special to Java and the JVM. It tells the JVM where to look for .class files. If you're compiling and running in a command shell, you set it using the -classpath option. Read the tool docs for details.
%

Similar Messages

  • How to  work with java in linux system

    Hi,
    java 1.5.0_04 program is not running in linux o.s.But the same program is working fine windows .
    can any body let me know what environment should i set to run it in linux system.
    test.java:19: error:Cannot find class "JLabel" [JLS 8]
    thanks.

    Hi,
    java 1.5.0_04 program is not running in linux o.s.But the same program is working fine windows .
    can any body let me know what environment should i set to run it in linux system.
    test.java:19: error:Cannot find class "JLabel" [JLS 8]
    thanks.

  • How do I get Java to work on my Mac Pro?

    I have the latest version of Java downloaded on my Mac, but when I play certain games on Pogo, it says it can't detect it.  How do I get Java to work?

    That is a link to a FAQ page with these answers:
    » Can I restore Apple Java 6 after uninstalling Oracle Java 7?
    » What are the system requirements for Java 7 on my Mac?
    » Why can't I use Chrome with Java 7 on my Mac?
    » How do I get Java 7 for my Mac?
    » How do I know if I have Java installed on my Mac?
    » How do I install Java 7 for my Mac?
    » How do I find out what version of Java I have on my Mac?
    » How do I enable Java on my Mac?
    » How do I clear the Java cache on my Mac?
    » How do I update Java on my Mac?
    » How do I uninstall Java from my Mac?
    » I do not have Mac version 10.7.3 (Lion) or higher. How do I get Java for other Mac versions?
    » Why will Applets not run after getting Java through Apple Software Update?
    » Why is Java 7 available only for Mac OS X 10.7.3 and above?
    » How do I get support or provide feedback on Java?

  • How SDA and DDA works in Java Card?

    Hi Friends,
    I want to know how exactly SDA and DDA works in Java Card technology..
    Yes, i know that SDA (Static Data Authentication) is valid for every transactions, but the key used is always same for every transaction made..
    and DDA (Dynamic Data Authentication) uses dynamic key for every transactions, it means that one key is valid for one transaction..
    But, i'm a little bit confused how this is implemented in Java Card..
    Is it related with SCP01 and SCP02?..
    Please help me regarding this..
    Thanks in advance

    Hi,
    I want to know how exactly SDA and DDA works in Java Card technology..This is an EMV concept and as such is not implemented in Java Card as such. You would have to create an implementation to be able to use SDA and DDA.
    But, i'm a little bit confused how this is implemented in Java Card..
    Is it related with SCP01 and SCP02?..It is not implemented natively in Java Card and are not related to SCP. SDA and DDA are for the EMV card application (card application data updates) and SCP is for the card manager (card content updates). While they could be considered similar concepts, they are not related in a Java Card sense.
    Cheers,
    Shane

  • How does the notify() call work in Java?

    Hi!
    Can someone help me:
    How does the notify() call work in Java?
    H�var

    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

  • How can I get Java plugin to work

    How can I get Java plugin to work ?

    Greetings Dun1203,
    Welcome to the Apple Support Communities!
    I understand that you would like to install or update Java on your Mac. For information on this process, please use the information provided in the attached link. 
    Java updates available for OS X on August 28, 2013 - Apple Support
    Cheers,
    Joe

  • How to configure the work manager java code to eclipse?

    Hello all,
                   I am working with the syclo work manager app. I have successfully installed all components required.
                   I imported the work manager mobile application and I want to import the standard work manager java code, what is the process to import java code into work space.
                   Guide me with some screen shots.
                   When I try to start the WM server it is giving me the following error:
    How to resolve the error.
    Please anyone provide me complete setup needed to run the work manager app smoothly.
    Please guide me.
    Thanks & Regards,
    Swaroopa.

    Swaroopa,
    That error is telling you the SAP JCo library cannot find one of the needed DLLs on the system.  The sapjco.jar loads two additional DLL files (sapjcorfc.dll and librfc32.dll).  Both should be installed by default into your ServerDev directory (assuming you are running Agentry 6.0.x).
    I would guess it is having trouble loading the librfc32.dll based on the message but confirm both are in the correct location.
    --Bill

  • How do I access Java on my Mac Pro so that I can make sure it's working so I can view Netflix "watch instantly"?

    How do I access Java on my Mac Pro so that I can make sure it's working so that we can view "watch instantly" on Netflix?

    There are various browser scripts
    1: Java (not needed much at all and highly advised to be turned off in Safari/Firefox preferences due to it's vulnerability)
    2: Javascript (if off, needs to be turned on in Safari/Firefox preferences as it's used A LOT)
    Note:  If your using a NoScript type blocker, then you need to whitelist the site. Or drag a Temp Allow All button to Firefox's Toolbar.
    3: Silverlight plug-in (needed for watching Netflix content, it's from Microsoft)
    4: Flash (needed for watching a lot of web based content, but requires constant checks to make sure it's current as they have a lot of security issues)
    Check your status here, works on all web browsers
    http://www.mozilla.org/en-US/plugincheck/

  • How i can start working with Java?

    Right now i am having only 8 months of exp in ABAP. can any one help me out to start working with Java specially for Netweaver Purpose

    It is great if you can get yourself familiar with java syntax, as is the case with any new langauage. However, the worst thing you can do is just code java in a top down approach. If you are not familiarizing yourself with OO concepts and best practices, then you are going to miss two important benefits that you will get from using OO programming - Reusability and flexibility in the frameworks that you develop (leveraging design patterns).
    These benefits will also be directly obtainable when you use ABAP objects.
    I am working in the opposite direction at the moment. I have some java experience, and I am starting to learn ABAP. I have used ABAP objects in my first project, and it was actually much better than I thought it would to be.
    Java and OO programming will be an ongoing learning experience. You will not be an expert for quite some time. I do not consider myself to be an expert by any means, and I've be studying OO and java for a few years.
    There is a fantastic book that explains OO concepts clearly, in much easier terms than the Gof "Design Patterns" book:
    Java Design: Objects, UML, and Process by Kirk Knoernschild
    You can read a few chapters at www.kirkk.com. (Use the JOUP link).
    Hope this helps you.
    - Brendan

  • HT5364 How do I enable Java? it's already enabled in preferences and it still won't work?

    How do I enable Java? it is already installed and enabled in preferences and it continues to say it isn't detected?

    If you are trying to use it in Safari, Safari/Preferences/Security. If not Safari, what are you trying to do?

  • How to Generate a Java file for a JSP Page

    Hi ,
    I am using weblogic11 .
    I am working on a JSP page which nearly consists of 4000 lines of code.
    I need to debug the file , but weblogic server is not generating the java file for the JSP pages .
    Please let me know how can i genertae Java file for the jsp pages ??

    JSPs are compiled into servlets automatically and those classes are stored in WEB-INF/classes folder. Servlet engine handles servlets.

  • How can i execute "*.java " files in Workshop

    Hi,
    Im sunil,new to this weblogic workshop8.1..i dont know how to execute standalone .java files or servlets in workshop.plz help me and tell the way.
    regards
    Budati sunil

    Im not too sure about the Java project. But single normal java files with public static void maain(String [] args) are very simple to execute.
    1. Write the java code somewhere lets call this class A.
    2. Make a dummy page flow.
    3. In the begin action of this pageFlow, call the main method of the A class directly using A.main(null) since main is a static method. your code will work fine.
    4. If you have to pass a String[] as parameters. Before calling main, create this String[] and then pass it.
    In this way you can make a jsp and take the input from the user also.
    Hope it helps
    Cheeers

  • How to call a java script?

    Hi,
    I m new to Indesign and also to MAC OS...
    I ve tried the sdk samples of InDesign CS3 on MAC OS. It works well.
    I m making changes to one of the samples (BasicPanel). I ve added few check boxes and buttons in it. I donno where to give the code for button(in the panel) event/action?
    I also need to know "how to call a java script from InDesign CS3 SDK ?"...
    I have the Scripts ready... Can someone provide the code used to call JS...
    Someone pls help me.....
    Thank You...

            Here s the code to call a Javascript:
            IDFile scriptFile;
            FileUtils::GetAppInstallationFolder(&scriptFile);                    //application folder path
            FileUtils::AppendPath(&scriptFile, PMString("Scripts", -1, PMString::kNoTranslate));               
            FileUtils::AppendPath(&scriptFile, PMString("Scripts Panel", -1, PMString::kNoTranslate));
            //inside the scripts panel, append path of the folder in which ur script is present.
            //Suppose, ScriptsPanel->NewFolder->Link.jsx
            FileUtils::AppendPath(&scriptFile, PMString("NewFolder", -1, PMString::kNoTranslate)); 
            FileUtils::AppendPath(&scriptFile, PMString("Link.jsx", -1, PMString::kNoTranslate));
            InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFi le));
            bool filestatus=scriptRunner->CanHandleFile(scriptFile);
            if(filestatus==1)
                scriptRunner->RunFile(scriptFile,kTrue,kFalse);
    Regards,
    tnhems

  • How to copy the java concurren program in oracle application

    Hi All
    I am working in oracle Apps R12.
    In AP (Account Analysis Report) is registered as java concurrent Program.
    Now i need to customize this concurrent program and add two new column and two parameter in that.
    Could any one pls provide me the steps that how to copy the Java concurrent,and make a new customized program.
    Whether copying a java concurrent program is same as cp registered as oracle report.
    Thanks & Regards
    Srikkanth

    Hi Sir,
    Thanks for your reply.
    I have find the xml file form data definition and in that they have written Sql query and they have called a Package.
    And the i have also taken the class file from the path as mentioned.
    Now i need to customize this report by adding two parameter and i need to add two new column to display in the rtf.
    Can you pls tell me the steps to copy or how to customize this report.
    Regards
    Srikkanth

  • How to terminate a java thread from c++ code?

    Hi,
    I made a screensaver which loads a jvm, forks a thread running a java class, wait until user's action(i.e. mouse move/click keyboard input), then terminate the java thread.
    However, I met a problem, How to terminate a running java thread from c++ code?
    Here is my code, but it does not work: (even after the terminate is called, jvm throws an error)
    JNIEnv* env;
    JavaVM* jvm;
    HANDLE hThread; //handle for the startThread
    unsigned __stdcall startThread(void *arg)
         jclass cls;
         jmethodID mainId;
         jint          res;
         int threadNum = (int)arg;
         res = jvm->AttachCurrentThread((void**)&env, NULL);
    cls = env->FindClass( MAIN_CLASS);
         mainId = env->GetStaticMethodID(cls, "main", "([Ljava/lang/String;)V");
         // setup the parameters to pass to main()
         jstring str;
         jobjectArray args;
         int i=0;
         args = env->NewObjectArray(1, env->FindClass("java/lang/String"), 0); //only one input parameters
         str = env->NewStringUTF("localhost");
         env->SetObjectArrayElement(args, 0, str);
         env->CallStaticVoidMethod(cls, mainId, args); // call main()      
         if (env->ExceptionOccurred()) {
                   env->ExceptionDescribe();
         return TRUE;
    Here is the main method:
    First create the jvm and load the thread. then tries to terminate the thread, but failed here
    switch (msg)
    { case WM_CREATE:
              JavaVMOption options[NUMBEROFOPTIONS];
              JavaVMInitArgs vmargs;     
              jint rc;
              vmargs.version = JNI_VERSION_1_4; /* version 1.4 */
              vmargs.options = options;
              vmargs.nOptions = NUMBEROFOPTIONS;
              vmargs.ignoreUnrecognized = JNI_FALSE;          
              rc=JNI_CreateJavaVM( &jvm, (void **)&env, &vmargs ); /* create JVM */
              /* We pass the thread number as the argument to the invoked thread */
              unsigned int threadId = -1;
              // to initialize a thread-safe C runtime library
              hThread = (HANDLE)_beginthreadex(NULL, 0, &startThread, NULL, 0, &threadId );
    } break;
    case (WM_DESTROY):
              CloseHandle( hThread );
              jvm->DestroyJavaVM(); /* kill JVM */
              Debug("Destroy Java Virtual Machine\n");
    }break;
    Note, after the thread "startThread" runs, it has an infinite loop and will not terminate, until the user clicks to terminate.(I didn't call jvm->DetachCurrentThread();_endthreadex(0); in the "startThread" because the java thread will not terminate by itself)
    Thus, the only way to terminate the thread is to call closehandle(hthread) in the main thread, which may cause jvm to throw an error.
    Do you know how to terminate a java thread safely???
    Thanks a lot

    Assuming that your java thread is in a loop of some kind. Such as
    int i=1; /* I tried using a boolean, I just could not get my C++ env, to change this value. So i decided to use an int */
    run {
    while(i)
    isdfjsdfj
    void seti()
    i=0
    So, B/4, i call destroyVM in my C++ code, i call this seti(). so the loop terminates, therefore my thread finishes executing and ends.
    Hope this helps
    tola.

Maybe you are looking for