Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Mill Town
Apr 17, 2006

stubblyhead posted:

Secondly, is it possible to make the class file executable on its own, similar to how you can write a perl script, set the execute flag and add #!/usr/bin/perl at the top?

That depends what you are trying to do. If you want to create an executable file that you can distribute to other people, then follow Sebbe's advice. On the other hand, if you want to make it easy to execute arbitrary .jar files on your machine only, then set up binfmt_misc (this assumes it's already compiled into your kernel, which it probably is): http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/java.txt;hb=HEAD

Adbot
ADBOT LOVES YOU

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE
Is there a solution for the issue where IE users that download .jar's get .zips?

covener
Jan 10, 2004

You know, for kids!

Shavnir posted:

Is there a solution for the issue where IE users that download .jar's get .zips?

sometimes you can coax IE with the "Content-Disposition" response header

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE

covener posted:

sometimes you can coax IE with the "Content-Disposition" response header

I've just been directly linking to the file so I donno where I'd put it in the response header.

covener
Jan 10, 2004

You know, for kids!

Shavnir posted:

I've just been directly linking to the file so I donno where I'd put it in the response header.

In some web containers static file servlet? Maybe a servlet filter if it doesn't expose any other way to add headers.

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE

covener posted:

In some web containers static file servlet? Maybe a servlet filter if it doesn't expose any other way to add headers.

No like from my webserver. Being hosted as a normal file through HTTP.

covener
Jan 10, 2004

You know, for kids!

Shavnir posted:

No like from my webserver. Being hosted as a normal file through HTTP.

assuming Apache HTTP Server -- modify your webserver configuration, via the real config or .htaccess, to add the "Header" directive in the context (<Location, <Files, etc)

http://httpd.apache.org/docs/2.2/mod/mod_headers.html
http://httpd.apache.org/docs/2.1/sections.html

MrPablo
Mar 21, 2003

Sebbe posted:

You are actually not telling Java to open HelloWorld.class, but rather telling Java to execute the main method on the class HelloWorld, which just so happens to be located in the directory you're in (which also by happenstance is the default class path.)

I'm pretty sure you need to package the program in an executable JAR to make it easily launchable.

If you don't need to put anything else in the manifest, then you can also use the -e option to set an entry point, like so:

code:
  jar cfe HelloWorld.jar HelloWorld HelloWorld.class

stubblyhead
Sep 13, 2007

That is treason, Johnny!

Fun Shoe

Sebbe posted:

You are actually not telling Java to open HelloWorld.class, but rather telling Java to execute the main method on the class HelloWorld, which just so happens to be located in the directory you're in (which also by happenstance is the default class path.)

So what happens if you have multiple classes with the same name within the classpath? How does java decide which one to execute? Or does it return an error?

epswing
Nov 4, 2003

Soiled Meat
This is trivial, just try it yourself!



vvv Edit: I was actually expecting it to complain about something. When I accidentally include servlet.jar twice in a webapp project, things start melting.

epswing fucked around with this message at 22:20 on Jun 2, 2010

stubblyhead
Sep 13, 2007

That is treason, Johnny!

Fun Shoe

epswing posted:

This is trivial, just try it yourself!

Point taken. I went ahead and did this, and java did successfully run one of the two classes. How does it decide which to run? Can I explicitly specify one over the other?

korofrog
Dec 15, 2006
smell my face!!!

fletcher posted:

This is pretty hard to read. No need to have a comment for every closing curly brace. Pretty much any IDE will have brace matching for you, so you simply put the cursor next to any brace and it will highlight the other one. It also looks like you are trying to do some weird string comparisons when you are working with numbers. Something like this may be easier to read and debug:

code:
public boolean checkFields() {
    double length = Double.parseDouble(poolLengthField.getText());
    double width = Double.parseDouble(poolWidthField.getText());
    double height = Double.parseDouble(poolHeightField.getText());
    if ((length == 0) || (width == 0) || (height == 0)) {
        poolStatus.setText("Please fill out all fields");
        if (length == 0)
            poolLengthField.setBackground(Color.RED);
        if (width == 0)
            poolWidthField.setBackground(Color.RED);
        if (height == 0)
            poolHeightField.setBackground(Color.RED);
        return false;
    } else {
        poolLengthField.setBackground(Color.WHITE);
        poolWidthField.setBackground(Color.WHITE);
        poolHeightField.setBackground(Color.WHITE);
        poolStatus.setText("");
        return true;
    }
}

It's been a personal preference of mine to keep track of what part I was closing off. Still, I'd like to get better at making the code easier to read, so thanks for the input. Also, I think I wanted to eliminate the parsing step, but I do see how that still does the same thing I want and make it easier to read.

I am in posted:

I'll give a hint about the culprit. If you redo the code above to use this brace style
code:
if(condition) {
  doSomething();
}
you should see the problem quite quickly.

I've tried that style of braces and I personally don't like it. I like seeing my braces line up.

Internet Janitor posted:

korofrog: is there a reason you're using compareTo("") rather than equals("")?

No particular reason, just saw a demo program in this book that used it and I probably don't know any better. =)

On to another problem..../sigh
code:
DecimalFormat nf = new DecimalFormat("###.#0");
		for(int i = 0; i < amountList.size(); i++)
			{
                          System.out.println(nf.format(amountList.get(i).toString()));
			}
I've imported java.util.DecimalFormat and when debugging I get two errors in Eclipse:

1)DecimalFormat.applyPattern(String, boolean)line: not available
2)DecimalFormat<init>(String)line: not available

amountList is an ArrayList object. If I don't try to apply the number format and just use (amountList.get(i)) I can get it to output, but not quite sure why I'm getting a source not found on the IDE.

I've tried a couple other things like getting rid of the .toString(), adding Double.valueOf. Sorry for the noobish questions, but I have to learn somehow...

EDIT: nevermind. I got it. Apparently, I can not do "###.#0" as that is not an acceptable pattern. I just switched all the #'s to 0's. D'oh! I really should not be trying to code simple things at 3am.

korofrog fucked around with this message at 08:05 on Jun 4, 2010

TagUrIt
Jan 24, 2007
Freaking Awesome
You could also use a plain String.format("%3.2f", amountList.get(i)); to convert a double or float to a string with 3 digits before the decimal point, and 2 after.

Max Facetime
Apr 18, 2009

korofrog posted:

I've tried that style of braces and I personally don't like it. I like seeing my braces line up.

My comment wasn't really about whether one brace style is better than another, rather it was the simplest step that would likely help you see the problem yourself.

Outlaw Programmer
Jan 1, 2008
Will Code For Food

korofrog posted:

EDIT: nevermind. I got it. Apparently, I can not do "###.#0" as that is not an acceptable pattern. I just switched all the #'s to 0's. D'oh! I really should not be trying to code simple things at 3am.

While I'm sure that was a problem, I don't think it was the problem. In your original code, you're taking a Number (probably Double) out of the ArrayList, then calling .toString() on it, then trying to format that string. The compiler is telling you the .format() method takes a double, not a string.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
I just started working on a Tomcat application and it's been a while since I've done anything with Tomcat. I'm having a heck of a time solving the "where do we store user's preferences" problem.

Basically, the application let's the system administrator configure, through the application interface, a location on the file system to store user files, among other things. All the serious configuration data would be stored here as well, but this means we need a known fixed writable location where we can store the path to this storage area.

Obviously everything inside the web application's directory is writable, but the problem is that if we release an update and the user drops the new WAR file in for auto-deployment, the settings we've stored there get clobbered along with everything else.

Another option is to store this in a dot-file relative to user.home, but my worry is that if Tomcat is running as a daemon then this might not be a good place. Is that always guaranteed to be a write-permitted location?

So where the hell can I store a single string value in a place that is both writable from inside the web application, always known at time 0, and isn't going to be clobbered by auto-deployment?

Flobbster fucked around with this message at 18:51 on Jun 4, 2010

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
You *could use jndi to specify that poo poo. You won't clobber it with deploys and each tomcat instance could have its own configuration (development/testing/production etc).

*I guess I should say could and not should here, since I don't know how enterprisey you wanna get.

trex eaterofcadrs fucked around with this message at 20:25 on Jun 4, 2010

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

TRex EaterofCars posted:

You should use jndi to specify that poo poo. You won't clobber it with deploys and each tomcat instance could have its own configuration (development/testing/production etc).

I tried that, but when I try to update the property from the control panel I've written in my app, I get an exception saying that the context is read-only.

In my WEB-INF/web.xml file I have this:

code:
    <env-entry>
        <env-entry-name>storageLocation</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
and I was trying to use this code to update it:

code:
    File location = ...;
    InitialContext ctx = new InitialContext();
    ctx.rebind("java:comp/env/storageLocation",
            location.getAbsolutePath());
What am I missing here? Do I need to get the context a different way?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
Well, I was thinking more along the lines of having the sysadmins put the config file location into the jndi string, so that way they have to be aware of the location's permission restrictions. Then that config file can be altered by your app.

Tomcat has a read-only jndi implementation, so unless you drop in another jndi provider (which I guess is not recommended) you won't be able to set anything in the directory "in-app".

korofrog
Dec 15, 2006
smell my face!!!

Outlaw Programmer posted:

While I'm sure that was a problem, I don't think it was the problem. In your original code, you're taking a Number (probably Double) out of the ArrayList, then calling .toString() on it, then trying to format that string. The compiler is telling you the .format() method takes a double, not a string.

Yes, I got rid of the toString() method. Like I said, I was up late trying to code something simple and missed the original problem of the number format pattern. In my head, I knew I wanted a precision of 2 with trailing zeroes so I thought using ###.#0 would work because I didn't want a leading 0. Turns out my thinking was flawed on the leading 0's and then I compounded the error by thinking I needed to use toString() on the arraylist. After I saw it I promptly smacked myself on the head.

I am in posted:

My comment wasn't really about whether one brace style is better than another, rather it was the simplest step that would likely help you see the problem yourself.

I know. Brace position is up to personal tastes as far as I'm concerned, as long as the code block is enclosed, it shouldn't matter where it goes. It took me a little bit and I eventually just redid the if statement conditions and saw the extra parentheses in my second block. I'll go back and redo the first if condition to be .equals instead of .compareTo. Thanks Internet Janitor, that does make more sense.

Also, to everyone else, thanks for your input. I'll probably have more questions soon enough.

RichardA
Sep 1, 2006
.
Dinosaur Gum

korofrog posted:

I know. Brace position is up to personal tastes as far as I'm concerned, as long as the code block is enclosed, it shouldn't matter where it goes. It took me a little bit and I eventually just redid the if statement conditions and saw the extra parentheses in my second block. I'll go back and redo the first if condition to be .equals instead of .compareTo. Thanks Internet Janitor, that does make more sense.
You do realize that the error is not the extra parentheses?

korofrog
Dec 15, 2006
smell my face!!!

RichardA posted:

You do realize that the error is not the extra parentheses?

Ahh....yes. I had retyped the whole section of code without the extra parentheses on that second if statement and completely missed the fact I had a semi-colon there. It's just as well though, I switched out the compareTo()'s I had to isEmpty() instead and it still works and makes more sense.

My newest problem is trying to get a buton to set the title of a frame.

code:
changeCompanyName.addActionListener(
				new ActionListener()
				{
					public void actionPerformed(ActionEvent e)
					{
						f.setTitle(companyNameField.getText());						
					}
				});
That's what I have right now where changeCompanyName is a button and f is the JFrame. It compiles fine but when I run it I get nullpointerexception with EventDispatchThread.run() line: not available. Any ideas on how I can fix this?

Shavnir
Apr 5, 2005

A MAN'S DREAM CAN NEVER DIE

korofrog posted:

That's what I have right now where changeCompanyName is a button and f is the JFrame. It compiles fine but when I run it I get nullpointerexception with EventDispatchThread.run() line: not available. Any ideas on how I can fix this?

The issue is that when you assign the ActionListener what you're really doing is defining a new inner class. Think scoping and I bet you'll figure out the solution :)

korofrog
Dec 15, 2006
smell my face!!!

Shavnir posted:

The issue is that when you assign the ActionListener what you're really doing is defining a new inner class. Think scoping and I bet you'll figure out the solution :)

Thanks! That helped. I had declared f as a class variable but in the constructor I had put JFrame f = new JFrame(). So after removing the first JFrame, it worked fine.

Also, Internet Janitor, that KeyListener on the length conversion part worked great! I had a couple issues with it at first but then realized I didn't change some variables after doing a cut & paste for the other measurements.

Luminous
May 19, 2004

Girls
Games
Gains
Any Eclipse RCP experts in here?

At work, we're trying to migrate one of our applications to the Eclipse RCP framework. For the most part, it has gone well. But we're hitting some sticking points for what we want to do.

1) There is a large part of our system that, naturally, has nothing to do with the presentation side of things. However, we want to allow plugins to listen in on some of this stuff. Now, normally this would be easy: whatever class can just add a listener to our stuff. But, how is this accomplished in a plugin? How can a plugin get a reference to some system in the main application so that it can add a listener? Is the assumption that such a system would have a static access point?

2) Workbenches, perspectives, pages, views, editors, etc. Fun stuff, and seems to offer a lot of possibilities. We want to accomplish something specific with this that is, at the moment, looking like a brick wall of impossibility.

Let's say we have the main application, which consists of a view on the left side, and an empty area on the right (a placeholder). Now, in the placeholder area, we'd like new "windows" (not necessarily floating - they could be tabbed pages, as in when that area is an editor area). But, these windows need to have views inside of them, and this is where our lack of experience in Eclipse RCP shines. Have no clue on how to do that.

A window within our workbench that can have its own views - views that can only be arranged, docked, etc, within that particular window. Preferably through its own perspective.

So: main window has a view and a placeholder area. Place holder area can have multiple windows, each window having its own perspective of editors and views. Possible?

3) Is there any really good place of information? We have some older books, and the java doc pages, and snippets that they have. But, for the most part, it feels like information about Eclipse RCP is just all over the place, and not very well organized with good examples.

FateFree
Nov 14, 2003

Im using reflection for a Service toString. As an example, AccountService has a field UserService, which is an interface implemented by UserServiceImpl and its parent is AbstractServiceImpl.

Assuming I already have the Field object for the UserService, how can I determine if it is an implementation of AbstractService? For example if I print out field.getType, I see the interface UserService. But if I try to do AbstractServiceImpl.class.isAssignableFrom(field.getType()), it always returns false.

Sorry for the convoluted question but it gets down to what condition can I use so that any Field that extends AbstractServiceImpl returns true?

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Luminous posted:

Any Eclipse RCP experts in here?

At work, we're trying to migrate one of our applications to the Eclipse RCP framework. For the most part, it has gone well. But we're hitting some sticking points for what we want to do.

1) There is a large part of our system that, naturally, has nothing to do with the presentation side of things. However, we want to allow plugins to listen in on some of this stuff. Now, normally this would be easy: whatever class can just add a listener to our stuff. But, how is this accomplished in a plugin? How can a plugin get a reference to some system in the main application so that it can add a listener? Is the assumption that such a system would have a static access point?


I'm no expert but I've had my trial by fire on a million line eclipse plugin set so maybe I can give you assistance with #1.

The plugin.xml defines dependencies and exports. So let's say you have two classes, one class called Worker in plugin com.example.workers, and another class called Listener in plugin com.example.listeners. You want the Worker to perform some work and the Listener to respond to the work. What you need to do is modify the com.example.workers/plugin.xml to export the Worker class. Then in the com.example.listeners/plugin.xml you need to assign the com.example.workers plugin as a dependency. The wizards are pretty decent for getting that done, although their intellisense is poo poo. I would manually type in the class/package info.

If you do it right you should have no trouble using intellisense across exported/dependent plugins WITHOUT importing them the "normal" Eclipse way.

This works in Eclipse 3.5, but I know they've just started using OSGi so I don't know if these instructions will work on Eclipse < 3.5.

Luminous
May 19, 2004

Girls
Games
Gains
So, is that saying that if we want a plugin to listen to something external, then that external thing must also be a plugin (or, otherwise developed in the rcp way of things, whatever that may be)?

For instance, let's say we have SomePackage.SomeClass in its own project. This SomeClass could be used as is in other programs simply by instantiating a new one

code:
SomeClass somedummy = new SomeClass();
Now, of course a plugin could do the same thing, instantiate its own SomeClass. But, if our main class already has SomeClass, we just want the plugin to listen to events from it

code:
//Inside SomePlugin
<SomeClass ref>.addListener(new Listener() { ... });
where SomeClass ref is part of the main app, not defined in any of the plugin areas. Ideally with SomeClass ref being passed in through a constructor to the plugin, or through a setter.

I should have prefaced my last post with a "we are just beginning to learn Eclipse RCP and know nearly nothing" so, apologies for the near brain-deadedess of the questions.

edit: For my first question, it looks like Extension Points is what we were looking for. Will have to put something on that to test it out. Hopefully resulting in me not having to follow up question #1, ha.

Luminous fucked around with this message at 15:23 on Jun 10, 2010

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Luminous posted:

So, is that saying that if we want a plugin to listen to something external, then that external thing must also be a plugin (or, otherwise developed in the rcp way of things, whatever that may be)?

For instance, let's say we have SomePackage.SomeClass in its own project. This SomeClass could be used as is in other programs simply by instantiating a new one

code:
SomeClass somedummy = new SomeClass();
Now, of course a plugin could do the same thing, instantiate its own SomeClass. But, if our main class already has SomeClass, we just want the plugin to listen to events from it

code:
//Inside SomePlugin
<SomeClass ref>.addListener(new Listener() { ... });
where SomeClass ref is part of the main app, not defined in any of the plugin areas. Ideally with SomeClass ref being passed in through a constructor to the plugin, or through a setter.

I should have prefaced my last post with a "we are just beginning to learn Eclipse RCP and know nearly nothing" so, apologies for the near brain-deadedess of the questions.

edit: For my first question, it looks like Extension Points is what we were looking for. Will have to put something on that to test it out. Hopefully resulting in me not having to follow up question #1, ha.
Yeah I don't know why I wrote export I meant extension... goddamn terminology.

But yes you will want to put EVERYTHING your plugins touch into other plugins.

Luminous
May 19, 2004

Girls
Games
Gains
Yeah, this seems to be working out well. Was just a step to realize that making something into a plugin doesn't mean it can no longer be used externally. Now that we're adding extensions and extension points, this is making a lot more sense.

I am still searching for a way to nest views and editors, as well as nesting a page in a page. The lack of information is leading me to believe this is impossible, which would be quite a shame as that changes our workflow concepts for the application :(

But if you, or anybody, know of a way (preferably simple) to get views into other views, then I am all ears.

edit: Or maybe I just want a new workbench window, which can have its own perspective. I just don't know.

Luminous fucked around with this message at 20:05 on Jun 10, 2010

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Luminous posted:

Yeah, this seems to be working out well. Was just a step to realize that making something into a plugin doesn't mean it can no longer be used externally. Now that we're adding extensions and extension points, this is making a lot more sense.

I am still searching for a way to nest views and editors, as well as nesting a page in a page. The lack of information is leading me to believe this is impossible, which would be quite a shame as that changes our workflow concepts for the application :(

But if you, or anybody, know of a way (preferably simple) to get views into other views, then I am all ears.

edit: Or maybe I just want a new workbench window, which can have its own perspective. I just don't know.

I'm not a "view guy", really. I know enough to be dangerous but I don't know the limitations of Eclipse's perspectives and views. I think you need to get the right terminology down and you'll probably find what you need.

Luminous
May 19, 2004

Girls
Games
Gains

TRex EaterofCars posted:

I'm not a "view guy", really. I know enough to be dangerous but I don't know the limitations of Eclipse's perspectives and views. I think you need to get the right terminology down and you'll probably find what you need.

Yeah, terminology is a bitch.

I do have another question regarding my first question, though: we have hit a little snag, and are hoping it is just our implementation (based off of the example provided here http://www.vogella.de/articles/EclipseExtensionPoint/article.html).

In that example, the plugin that handles the extensions loops through the extensions that implement the extension point. But, when it loops through, it is actually creating new instances. This means, for instance, trying to add a listener results in a listener being added, but for an instance of the extension that we aren't actually using. Hur.

The createExecutableExtension method seems to be the culprit for this, but we do not see a getExecutableExtension (for instance) that will get already existing ones. Maybe that's not even possible, as is.

So basically:
Plugin 1 defines an extension point and creates implementation code to loop through all implementing extensions and do something with them through the appropriate extension interface.

Plugin 2 defines some class that implements the appropriate extension interface.

Plugin 1 calls the appropriate extension interface, but on a "local" instance instead of the instance explicitly created in Plugin 2. What?

Luminous fucked around with this message at 21:31 on Jun 10, 2010

Luminous
May 19, 2004

Girls
Games
Gains
Ugh, Eclipse RCP is making me feel like a drooling retard. Why can I not find a simple example of how to share data across plugins?

I already have some classes that represent data and actions on that data, and want to create a plugin that can either (or both) display that data or trigger actions on that data.

I would have assumed this is a fairly common thing, but every example is so basic that you can't go anywhere from there. The only thing I can assume is that for such behavior, plugins expect static access points/factories. I've no real problem with this, but I simply want a yay or nay on if this is standard practice or if there is a different way that plugins accomplish data sharing and interaction.

Extension points are nice, but, they don't seem to provide what we're looking for and I am trying to figure out if I just need to shift my thinking and expectations even farther in order to get a grip on how Eclipse RCP wants things done.

This would be helped immensely by a simple application that has views in plugins that interact with or display data from some other plugin. The simplest example I've found that works is RSSOwl, and, that is far from simple.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

Luminous posted:

I already have some classes that represent data and actions on that data

Call the plugin that contains these "Plugin-A".

quote:

and want to create a plugin that can either (or both) display that data or trigger actions on that data.

And call this "Plugin-B".

Plugin-B must depend on Plugin-A. You have a couple options -- static classes or factories that are initialized when Plugin-A loads (therefore they'll always be ready by the time Plugin-B loads), or add instance methods to the activator/plugin class for Plugin-A that give you access to the data so that somewhere in Plugin-B you can say Plugin_A.getDefault().getMyDataModel()....

Now, if you want Plugin-B to be able to respond to changes in Plugin-A's data that it didn't initiate, you'll need to make Plugin-A expose some kind of listener interface that Plugin-B can hook into when it loads. You can either do that hooking entirely in code, or this can be where extension points come in, because then you just add the listeners as extensions in the plugin.xml.

IMlemon
Dec 29, 2008
I need to create a thread that waits until something happens and then does some stuff. How do I go about that? I assume this is a big no-no.

code:
while(true) {
    if (testSomeConditions())
       doStuff();
}
I can put in a Thread.sleep(1) or whatever there but that still seems quite bad.

Fly
Nov 3, 2002

moral compass

IMlemon posted:

I need to create a thread that waits until something happens and then does some stuff. How do I go about that? I assume this is a big no-no.

code:
while(true) {
    if (testSomeConditions())
       doStuff();
}
I can put in a Thread.sleep(1) or whatever there but that still seems quite bad.

Use Object.wait() and Object.notify().

Angryhead
Apr 4, 2009

Don't call my name
Don't call my name
Alejandro




Since I'm on summer vacation (lots of free time!) I decided to do something that might be productive and help me in the future (I just passed the first year of my gymnasium and I'm thinking of studying something IT related in whatever university) - learning Java. This is my first experience with any programming language.

So, following the advice in the OP second post, I've completed two of these tutorials so far (Total beginner and Persistence).

What next?

I guess I'll do the Debugger and Workbench tutorials from the same page, but what after that?

epswing
Nov 4, 2003

Soiled Meat

Angryhead posted:

I guess I'll do the Debugger and Workbench tutorials from the same page, but what after that?

Think of a project: a problem to solve, something that helps you (or someone else) complete a computer-related task, a small game, etc. Make it really small, don't be too ambitious, it's better to complete a small project than to abandon a medium/large project.

Then actually do it.

yatagan
Aug 31, 2009

by Ozma

Angryhead posted:

What next?

Check out codingbat.com

Adbot
ADBOT LOVES YOU

FateFree
Nov 14, 2003

If I'm making a generic class <T extends BaseObject, V> how can I enforce that V is a long? If I say <V extends Long> I get an ugly warning about not being able to extend final classes, even though it seems to accomplish what I want. Is there any other way?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply