Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By bradjohns94

Thread: Source Not Found compiling error

  1. #1
    bradjohns94 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Source Not Found compiling error

    Hey all,

    I'm starting college as a CS major soon so I figured it may not be a bad idea to try a quick review program in java to try to be a little less rusty. For my compiler I'm using eclipse which I am fairly confident is commonly used and understood so here's where my question comes through. Essentially the program is pretty basic, it pops up a window with a JButton and when the button is pressed it opens an optionPane that outputs a randomly generated sentence. My issue is whenever I press the button I get a "Source not found" compiling error that goes something along the lines of: "The source attachment does not contain the source for the file EventDispatchThread.class. You can change the source attachment by clicking change attached source below:"

    I'll post the actionHandler part of the code and any more upon request. Does anyone know how to fix this?

    (P.S. I have no idea if the OS is going to come into play here but if it does this is an Ubuntu laptop)

    Java Code:
    	private class actionHandler implements ActionListener{
    		public void actionPerformed(ActionEvent event){
    		    String message = output.words(); //the randomly generated words to make the sentence
    		    JOptionPane.showMessageDialog(null, String.format(message, event.getActionCommand()));
    		}
    	}

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default Re: Source Not Found compiling error

    Please show the actual error message. Are you sure that it's a "compiler" message and not an exception, since it appears to be showing up at run time not at compile time.

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,563
    Rep Power
    25

    Default Re: Source Not Found compiling error

    Please post the full text of the error message.

    Are there any error messages from the compiler when you compile the program? Your description of the problem sounds like it happens when you are trying to execute the program, not when you are compiling it.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    bradjohns94 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Source Not Found compiling error

    Okay... yeah... I may or not be a little bit stupid. Its been a while since I learned what little I know.

    Anyway, as it turned out I was just too stupid to scroll up in the errors and its actually a Null Pointer Exception:

    "Exception in thread "main" java.lang.NullPointerException
    at gui.<init>(gui.java:25)
    at slander.main(slander.java:7)" (The programs called "Slander" because it makes random sentences about people that tend to be slander...)

    for the record: gui line 25 assigns a random number value to an array that is later used in switch blocks to assign them with the proper word per value.

    " for (int x = 0; x<3; x++){
    numbers[x] = 1+rand.nextInt(5);
    }"
    (I figure "rand" is self explanatory...)

    and then the line from the main class is just creating the object from the other class.

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

  6. #6
    bradjohns94 is offline Member
    Join Date
    Sep 2012
    Posts
    3
    Rep Power
    0

    Default Re: Source Not Found compiling error

    Yeah, I can probably take it from here... thanks
    Fubarable likes this.

Similar Threads

  1. Source not found error even after including it
    By nehatomar in forum Eclipse
    Replies: 0
    Last Post: 06-03-2012, 11:10 PM
  2. Replies: 4
    Last Post: 04-23-2010, 05:51 PM
  3. Jsp source not found
    By jadeite100 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 01-17-2010, 01:35 AM
  4. Error in compiling Firewall source code
    By ajib85 in forum Networking
    Replies: 8
    Last Post: 10-02-2008, 04:37 AM
  5. Strange error message "Source not found"
    By ppayal in forum Eclipse
    Replies: 0
    Last Post: 11-25-2007, 06:19 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •