Results 1 to 11 of 11
  1. #1
    kieran is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default Help please with a simple code change?!

    Hello all,

    Please can I precede my comments by stating that I have no programming experience but I am a graduate Psychologist in need of some programming advice with a project that I need to work on urgently. I am willing to offer a thank you payment to anyone who can help or a donation to your charity of choice.

    I am looking to change just one number within an existing and working java code (several times over), and am aware of some basic things I need to do to achieve this, but no idea how to do them, I have tried to use some online guides but it's well above my comprehension...

    I use a PC, with Vista operating system and Google Chrome, and the code is written on a notepad file. The code (named "control") is stored within a folder on my desktop along with a corresponding CLASS file of the same name; a further code file name "more applet" and corresponding CLASS file of the same name; and chrome HTML document.

    1) I am aware that I need to set my system's search path to the java directory, however unsure of how to do this?

    2) I can call the "call javac.exe" to compile the revised code. I really dont know how to do this?

    So far I have been able to download the Java Developers Kit, and have been able to find the java directory (I think) using DOS. However where I go from here in terms of matching up DOS, Java and my code files, I really am stuck.

    Thank you in advance and sorry if this is a really cheeky request, I hope you can help.
    Last edited by kieran; 01-12-2011 at 07:16 PM.

  2. #2
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    you need to navigate to the file location using cd first, then when in the directory where the file you want to compile is, type:
    Java Code:
    javac filename.java.
    it will either display an error or bring the prompt back up meaning it compiled successfully, then to run it you can type:
    Java Code:
    java filename
    I believe this is what are you asking, if it is not, I apologize. If you haven't set the javac path variable here is a really good tutorial for setting that up:
    The New Boston Java Programming Tutorial – 1 – Installing the JDK
    Last edited by sunde887; 01-12-2011 at 08:28 PM.

  3. #3
    kieran is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default

    Thanks for your reply, I am able to navigate to the file, but setting the javac path seems to be beyond me. A friend with some computer skills has told me now even how to use the full path to javac, however now I have a different problem, when I try to call the .java file to make changes to the class file, it now says that there are 3 warning about deprecations, this I have no clue how to rectify...

    ..I felt like I was really getting somewhere till then!:D

  4. #4
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    The deprecation is unfortunately a bit beyond what I know currently, you were able to get the path set to allow you to javac though?

  5. #5
    kieran is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default

    Thanks sunde, yeah as far as I am aware apart from these deprecations, I would be able to run the modified code

  6. #6
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default

    Warnings can be ignored - they are just warnings. Errors on the other hand cannot.

    So, don't worry about that. For javac to work properly, you need to set the CLASSPATH environment variable in windows to match the location of your java install. The variable is usually under 'My Computer/Properties/Advanced/Environment Variables' in windows XP - might be slightly different in vista.

    If the path is set, then going to your project folder via command line and running 'javac MyFile.java' where MyFile.java is whatever your file is called, should work. See the oracle website for help with setting the path.

    If all that works for you, then you can compile and safely ignore deprecation warnings. To run the resulting program, you can type:
    java MyFile
    where MyFile is the same name as the MyFile.java. After compilation, several .class files will appear, when you run java MyFile, it is these class files you are executing. Does that help at all?

  7. #7
    kieran is offline Member
    Join Date
    Jan 2011
    Posts
    4
    Rep Power
    0

    Default

    Thank you so much for the advice, im going to have a bit more of a play around and see how I get on

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,004
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by quad64bit View Post
    Warnings can be ignored
    That should be the "Most Dangerous Statement Of The Year 2011". ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  9. #9
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default

    haha, Specifically deprecation warnings in someone else's code :D

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,004
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by quad64bit View Post
    haha, Specifically deprecation warnings in someone else's code :D
    Well, officially those deprecated methods were/are allowed to be removed; Sun never had the balls to do so, maybe Oracle shows more courage; that should teach the bastards who still use them ;-)

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  11. #11
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    6

    Default

    Yeah, sadly though, some deprecated methods remain the best way to do things - Font metrics calculation is the only one that comes to mind, but there are a couple others :D

Similar Threads

  1. Replies: 2
    Last Post: 02-19-2014, 05:36 PM
  2. Replies: 2
    Last Post: 01-09-2010, 06:05 AM
  3. Replies: 3
    Last Post: 04-14-2009, 04:44 PM
  4. my code doesn't change background color
    By javanoobita in forum New To Java
    Replies: 5
    Last Post: 02-22-2009, 04:30 AM
  5. Servlet code change
    By joeyxaza in forum Java Servlet
    Replies: 0
    Last Post: 02-20-2009, 05:15 PM

Posting Permissions

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