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
Volguus
Mar 3, 2009

long-rear end nips Diane posted:

I'm updating 30 year old logistics software that's been converted from like COBOL and Power-something(I can't remember the actual name) to Java using some proprietary tool. I know it interfaces with Weblogic and Oracle DB stuff but from the conversation I had with my manager I'd be working in pure Java 99% of the time.

Well, Weblogic is an application server so look at Web applications and databases. Depending how deep in the JavaEE hole they went, you will probably need to look into ORMs (JPA and hibernate probably), maybe JSF/JSP . Other than that ... application converted from COBOL to Java: good luck.

On the other hand, i wouldn't worry to much about it. They'll train you on-site on the specific things they'll need. Therefore, some Java familiarity is all you need, at which point the Oracle tutorial is fine.

Adbot
ADBOT LOVES YOU

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

long-rear end nips Diane posted:

I just got my first programming job out of college, and they're using Java & the Eclipse IDE. I have literally zero experience with either, since all my undergrad work was either in C++ or Python. I'm going through the Java w/ Eclipse tutorial that's linked in the first post, but does anyone have a good recommendation for where to go after that? I've got a little under a month before I start, and while there will be training at work I'd like to be at least a bit familiar with all of this stuff before I start, just so I'm not totally useless.

Where did you go to school that undergrad was all C++??

Just read all the official Java tutorial tracks, they're good.

long-ass nips Diane
Dec 13, 2010

Breathe.

Zaphod42 posted:

Where did you go to school that undergrad was all C++??

Just read all the official Java tutorial tracks, they're good.

A mix of Austin Community College and University of Houston. Everything up through Data Structures & Algorithms was in C++, and then once I got into more advanced and elective stuff it was either theory and no coding or choose your own language, so I ended up working a bunch with python.

I've spent about an hour on the Eclipse tutorials linked in the OP and they're good, moving a little slowly so I'm probably just going to skim the rest of the videos and go into the official tutorials.

Thanks for the help, both of y'all.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

long-rear end nips Diane posted:

A mix of Austin Community College and University of Houston. Everything up through Data Structures & Algorithms was in C++, and then once I got into more advanced and elective stuff it was either theory and no coding or choose your own language, so I ended up working a bunch with python.

I've spent about an hour on the Eclipse tutorials linked in the OP and they're good, moving a little slowly so I'm probably just going to skim the rest of the videos and go into the official tutorials.

Thanks for the help, both of y'all.

Huh, I graduated from UT Dallas 7 years ago and we were using mostly Java with a little bit of C++ and Python here and there, and even back in high school in Austin we were using mostly Java. My Data Structures & Algorithms was in java.

C++ is good poo poo but Java's definitely very marketable right now. Probably the two best languages to know. (After that, javascript and objective-c? :barf:)

FAT32 SHAMER
Aug 16, 2012



I got hired because I know Java Swift and Python, which seems to be the big three corps care about here in Detroit (there's also a fuckton of embedded c++ stuff)

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

long-rear end nips Diane posted:

I'm updating 30 year old logistics software that's been converted from like COBOL and Power-something(I can't remember the actual name) to Java using some proprietary tool. I know it interfaces with Weblogic and Oracle DB stuff but from the conversation I had with my manager I'd be working in pure Java 99% of the time.

You're going to see some seriously hideous poo poo in this codebase, I guarantee it. Just bear in mind that the Developers thread is here and please feel free to post any questionable design (anti-)patterns and development practices so that we can laugh at your misfortune try to help you learn how to do things right for the next place you work.

Sedro
Dec 31, 2008

long-rear end nips Diane posted:

I'm updating 30 year old logistics software that's been converted from like COBOL and Power-something(I can't remember the actual name) to Java using some proprietary tool. I know it interfaces with Weblogic and Oracle DB stuff but from the conversation I had with my manager I'd be working in pure Java 99% of the time.

Power Systems? You will be maintaining the generated output of the COBOL-to-Java conversion? I've seen that stuff before. It's "pure Java" in the sense that it's syntactically valid Java code (or in my experience, not quite valid).

MercurialOne
Feb 28, 2016
I'm learning Java now.

This compiles, runs, and prints horse:

code:
boolean x = true;
String s = "Horse";
System.out.println(x ? s: 1L);
I understand why/how it works, but what I don't get is how it translates into bytecode. A long and an object reference are different sizes, does it not matter which one you're talking about when setting up the call stack?

Or, is ternary in Java just syntatic sugar for an if statement, and it actually translates into two code paths, with their own copy of System.out.println?

M31
Jun 12, 2012
The primitive is autoboxed to a Long object during compilation, so both will be references.

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

long-rear end nips Diane posted:

I just got my first programming job out of college, and they're using Java & the Eclipse IDE. I have literally zero experience with either, since all my undergrad work was either in C++ or Python. I'm going through the Java w/ Eclipse tutorial that's linked in the first post, but does anyone have a good recommendation for where to go after that? I've got a little under a month before I start, and while there will be training at work I'd like to be at least a bit familiar with all of this stuff before I start, just so I'm not totally useless.

Uninstall eclipse and install intellij idea

CPColin
Sep 9, 2003

Big ol' smile.

MercurialOne posted:

I'm learning Java now.

This compiles, runs, and prints horse:

code:
boolean x = true;
String s = "Horse";
System.out.println(x ? s: 1L);
I understand why/how it works, but what I don't get is how it translates into bytecode. A long and an object reference are different sizes, does it not matter which one you're talking about when setting up the call stack?

Or, is ternary in Java just syntatic sugar for an if statement, and it actually translates into two code paths, with their own copy of System.out.println?

You can use the javap command to see what the bytecode looks like. In this case, it looks like this:

code:
$ javap -c Test.class 
Compiled from "Test.java"
public class Test {
  public Test();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V
       4: iconst_1
       5: istore_1
       6: ldc           #2                  // String Horse
       8: astore_2
       9: getstatic     #3                  // Field java/lang/System.out:Ljava/io/PrintStream;
      12: iload_1
      13: ifeq          20
      16: aload_2
      17: goto          24
      20: lconst_1
      21: invokestatic  #4                  // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      24: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      27: return
}
You can see here what M31's talking about. The Long.valueOf() call boxes up the primitive into a Long instance and then passes it (or the String) to the overload of System.out.println() that takes an Object.

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

MercurialOne posted:

I understand why/how it works, but what I don't get is how it translates into bytecode. A long and an object reference are different sizes, does it not matter which one you're talking about when setting up the call stack?

Or, is ternary in Java just syntatic sugar for an if statement, and it actually translates into two code paths, with their own copy of System.out.println?

Well, let's look at how it ends up in bytecode. Starting with this Horse.java:

code:
public class Horse {

    public static void main(String[] args) {
	boolean x = true;
	String s = "Horse";
	System.out.println(x ? s: 1L);
    }
}
This is from javap -c Horse.class, showing the final bytecode:

code:
Compiled from "Horse.java"
public class Horse {
  public Horse();
    Code:
       0: aload_0
       1: invokespecial #1                  // Method java/lang/Object."<init>":()V
       4: return

  public static void main(java.lang.String[]);
    Code:
       0: iconst_1
       1: istore_1
       2: ldc           #2                  // String Horse
       4: astore_2
       5: getstatic     #3                  // Field java/lang/System.out:Ljava/io/PrintStream;
       8: iload_1
       9: ifeq          16
      12: aload_2
      13: goto          20
      16: lconst_1
      17: invokestatic  #4                  // Method java/lang/Long.valueOf:(J)Ljava/lang/Long;
      20: invokevirtual #5                  // Method java/io/PrintStream.println:(Ljava/lang/Object;)V
      23: return
}
We can ignore the Horse default constructor, which is just calling the default Object constructor.

So then iconst_1 pushes 1 onto the stack and istore_1 saves that 1 into the local variable indexed by 1; that's your boolean x = true.

Then ldc pushes an item from the reference pool, in this case "Horse", and astore_2 saves that reference into the local variable indexed by 2; that's String s = "Horse".

getstatic pushes an item from the static reference pool, in this case System.out.

iload_1 loads the value from variable 1, which is 1 (from iconst_1 originally). This is going to be the boolean x.

ifeq tests the current stack (1) against 0, which will fail. If it had succeeded it would have branched to line 16.

Since the test failed (1 was not 0), next up is aload_2, loading the reference in variable 2 onto the stack, which is "Horse" (from astore_2).

Then an unconditional goto to line 20 to skip over the 1L code.

On 20, continuing execution, invokevirtual #5, calls whatever method the Horse class has in its constant pool at index 5, which is PrintStream.println(Object), which will print "Horse" since Horse is on the stack.

And then 23 will return out of main.

On 16, lconst_1 will load the long constant 1L onto the stack, and then on 17 invokestatic #4 does basically the same thing as invoke virtual to convert the Long to a String through valueOf.

EDIT: refresh before posting.

smackfu
Jun 7, 2004

M31 posted:

The primitive is autoboxed to a Long object during compilation, so both will be references.

Would it have given an error before autoboxing existed?

PierreTheMime
Dec 9, 2004

Hero of hormagaunts everywhere!
Buglord
I've been asked to mess with an API that's giving me a hell of a time getting started. I downloaded the source and built it in Maven just fine, but the resulting .jar is apparently missing a ton of dependencies and tracking them all down is a pain. The pom defines the build as jar-with-dependencies but the resulting jar doesn't have them. I'm not terribly experienced with Maven and dependency management, so it's highly possible I'm loving something up. Anyone have any experience with FetchApp? The compiled jar is only 43kb and seems to have all the API classes/methods but fails to compile due to a mountain of ClassDefNotFound errors, mostly from apache commons and jetty.

Edit: finally tracked down all the libraries independent of the product. Good lord if they're going to leave them off at least let us know which ones we need. drat thing doesn't have any documentation either. :sigh:

PierreTheMime fucked around with this message at 00:04 on May 14, 2017

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

smackfu posted:

Would it have given an error before autoboxing existed?

It wouldn't compile before autoboxing existed.

code:
$ /cygdrive/c/j2sdk1.4.2_19/bin/javac.exe Horse.java
Horse.java:6: incompatible types for ?: neither is a subtype of the other
second operand: java.lang.String
third operand : long
        System.out.println(x ? s: 1L);
                             ^
1 error

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...
Dare I ask why you have a copy of Java 1.4 laying around?

ulmont
Sep 15, 2010

IF I EVER MISS VOTING IN AN ELECTION (EVEN AMERICAN IDOL) ,OR HAVE UNPAID PARKING TICKETS, PLEASE TAKE AWAY MY FRANCHISE

Volmarias posted:

Dare I ask why you have a copy of Java 1.4 laying around?

You can still download 1.4, which is what I just did.

UnfurledSails
Sep 1, 2011

Zaphod42 posted:

Huh, I graduated from UT Dallas 7 years ago and we were using mostly Java with a little bit of C++ and Python here and there, and even back in high school in Austin we were using mostly Java. My Data Structures & Algorithms was in java.

C++ is good poo poo but Java's definitely very marketable right now. Probably the two best languages to know. (After that, javascript and objective-c? :barf:)

My first class at Stanford was some sort of fake Java with custom libraries (to teach OOP), second class was C++11 (to teach file systems, threads, processes, and... mapreduce? I don't remember), and then I used nothing but C until I graduated. Now I use only Java and some python scripts at work hah. I'm 9 months in, and will be mentoring a new hire from UT Dallas. Good to know that he's actually has way more experience with the language.

EVIL Gibson
Mar 23, 2001

Internet of Things is just someone else's computer that people can't help attaching cameras and door locks to!
:vapes:
Switchblade Switcharoo
I am writing a plug-in for a tool called burp suite. In it, there is an class called ScanIssue which has an interface in am implementing a new classcalled CustomScanIssue

Here is a link to a java file that uses the same class I have implemented before. The CustomScanIssue is near the bottom of that file. In that same project are the interfaces for everything burp related.

https://github.com/nVisium/xssValidator/blob/master/burp-extender/src/burp/BurpExtender.java

Now the issue is something changed in my environment (started with 1.8 and what I have been using all this time) that is now causing an error that is yelling at me to create the three methods for the httpinterface class. I do the bare min (port method returns an integer, return a 0 ) but it is saying it is still wrong. I forgot what it says exactly, but the three methods from httpinterface (getport, gethost, and getprotocol ) that I create in CustomScanIssue are are highlighted as being wrong. Is this where I use the "super.getPort()"?

Any guesses what was the setting that changed that allowed this code to exist before that is now preventing it from working? I thought it could be compliance but I don't think its that.

CPColin
Sep 9, 2003

Big ol' smile.
When you say "httpinterface," do you mean the "IHttpService" interface? If so, the problem would be that CustomScanIssue doesn't implement IHttpService, so the @Override annotations are incorrect. That doesn't quite gel with what you're asking about, though. Can you provide more information about the errors you're seeing?

hooah
Feb 6, 2006
WTF?
I've decided to start learning how to use Maven, but when I start up a new Maven project in IDEA with the org.apache.maven.archetypes:maven-architype-j2ee-simple archetype, the generated/downloaded project already has errors. For example, IDEA can't find the plugin org.apache.mavin.plugins:maven-javadoc-plugin and the POM has two errors: there's a <module>site</module> tag that IDEA says can't be resolved (I think that might be because I don't have a site project yet, maybe?). The other is in this tree:
XML code:
<build>
  <pluginManagement>
	 <plugins>
		<plugin>
		   <groupId>org.apache.maven.plugins</groupId>
		   <artifactId>maven-site-plugin</artifactId>
		   <configuration>
			  <unzipCommand>/usr/bin/unzip -o > err.txt</unzipCommand>
		   </configuration>
		</plugin>
	 </plugins>
  </pluginManagement>
</build>
IDEA says that the unzipCommand element is not allowed there. Should I just have not used an archetype in the first place? It seems silly to have something provided for use that doesn't work out-of-the-box.

Boz0r
Sep 7, 2006
The Rocketship in action.
Which tools are you guys using for memory profiling. Our customers are reporting slowing down after a couple of days :-(

smackfu
Jun 7, 2004

hooah posted:

IDEA says that the unzipCommand element is not allowed there. Should I just have not used an archetype in the first place? It seems silly to have something provided for use that doesn't work out-of-the-box.

IDEA errors on pom files are not "real" errors, more like warnings. Running it with Maven will show you whether it's an actual problem.

Boz0r
Sep 7, 2006
The Rocketship in action.
I've got a Java EE application with GWT. I'd like to add Doom or something as an easter egg. What's the easiest way to embed it in a page?

Le0
Mar 18, 2009

Rotten investigator!
I've been working on a java app to learn more about the language (mostly been doing C and Python), and I'd like to make a GUI for it. What framework would you guys recommend for this? Would SWING be alright?
Also if that might influence the choice of this, I might turn it into a web app later on.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
If you use JavaFX, you can use css to style the gui. This could save time if you're going to make it a webapp later.

John F Bennett
Jan 30, 2013

I always wear my wedding ring. It's my trademark.

I would definitely choose JavaFX over Swing if you're looking to create a desktop app.

But I don't know about running them on the web, is such a thing even possible? If you're just looking for a web framework and want to keep it lightweight, I've been hearing good things about Sparkjava or Spring Boot.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
I just meant if you went to make a web app, you could use the same css to make it look the same.

Volguus
Mar 3, 2009

Snak posted:

I just meant if you went to make a web app, you could use the same css to make it look the same.

I am not that familiar with the JavaFX CSS, but aren't the web (browser understood) one and JavaFX one quite different? They have similarities, but very few to even hope that one could translate into the other easily. For desktop, just go with JavaFX since Oracle abandoned Swing. On another hand, they kinda abandoned java altogether so ... yeah, that's that.

Snak
Oct 10, 2005

I myself will carry you to the Gates of Valhalla...
You will ride eternal,
shiny and chrome.
Grimey Drawer
I did not know that. I have used JavaFX quite a bit, but never actually styled it with CSS, I was just told when I was learning it that it could be styled with CSS. That's my mistake.

John F Bennett
Jan 30, 2013

I always wear my wedding ring. It's my trademark.

JavaFX is the only reason I still use Netbeans, because of the ease of using Scenebuilder with it.

Or have things changed in the meantime regarding Scenebuilder and other IDE's?

Volguus
Mar 3, 2009

Snak posted:

I did not know that. I have used JavaFX quite a bit, but never actually styled it with CSS, I was just told when I was learning it that it could be styled with CSS. That's my mistake.

Oh, it can. It certainly can. And you have common directives like background and color and stuff like that. But compared to what a browser can do and knows, the Java CSS is quite ... primitive. And, not to mention, if you move to the web, just do the styling for the web, don't even look at the desktop application. After all, these are 2 very different mediums to present to the user.

Or, go full retard and use the browser like a desktop application (Electron).

Tuxide
Mar 7, 2010
Lipstick Apathy

Snak posted:

I just meant if you went to make a web app, you could use the same css to make it look the same.

The reason they support CSS in JavaFX is not to enable portability from JavaFX to web applications. It's to enable web designers who should already be familiar with CSS (but not necessarily Java) to style themes for JavaFX programs without having to learn too many new things. Either way, if you're using JavaFX, you should be using JavaFX CSS to separate concerns if you need to do any sort of styling.

JavaFX CSS is based on a subset of the W3C CSS 2.1 with some things in 3. There are, however, many differences between JavaFX CSS and HTML CSS.

You use JavaFX CSS properties to manipulate class variables, and the property names all use the vendor extension "-fx-". In other words, JavaFX CSS properties and HTML CSS properties are different. For example, you use -fx-font-family instead of font-family, which have similar purposes but are entirely different properties. Unlike its HTML CSS counterpart, -fx-font-family does not support comma-separated font family names.

Pseudo-classes in HTML CSS are not really supported, for example ":active" and ":focus". JavaFX Nodes do support ":pressed" and ":focused" which are similar. ":link" and ":visited" are not supported, with the exception of ":visited" for Hyperlink objects.

The color model is HSB, not HSL.

To learn more about JavaFX CSS, read Oracle's reference for it.

Le0 posted:

I've been working on a java app to learn more about the language (mostly been doing C and Python), and I'd like to make a GUI for it. What framework would you guys recommend for this? Would SWING be alright?
Also if that might influence the choice of this, I might turn it into a web app later on.

If your intention is to make a web application while teaching yourself the Java language, there's always GWT, assuming you can figure out how to get your existing code to work with it.

If you want to make a desktop application first and with the intention of making a web application later on, use JavaFX and do your user interface in FXML. This will enable you to separate your application and presentation layers, and in the long run, you'll find working with FXML for desktop applications similar to working with web application technologies like GWT UiBinder.

JavaFX is okay for desktop applications in general, but it does take up a lot of memory when you're doing certain things with it. I still use Swing widgets instead of JavaFX controls for some things, for example displaying logs.

Volguus
Mar 3, 2009
Isn't GWT dead by now? I remember using it back in 2008-2009 but that's pretty much it. It was terrible back then, the applications one would create with that were pretty much desktop applications in the browser, which is an extremely dumb idea in the first place.

PierreTheMime
Dec 9, 2004

Hero of hormagaunts everywhere!
Buglord
Super basic and silly question, but it's not come up for me before and I was curious: is there a way to apply a String.format() to additional lines of a String variable that contains return characters? I checked around for the usual sources and didn't really come up with anything.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

How do you mean? Return characters shouldn't matter, it just fills out the placeholders with the arguments you pass

PierreTheMime
Dec 9, 2004

Hero of hormagaunts everywhere!
Buglord

baka kaba posted:

How do you mean? Return characters shouldn't matter, it just fills out the placeholders with the arguments you pass

It applies the format to the first line only, putting additional lines at the first position. I can just split it by the return and loop through the result but I was curious if there was a solution to apply it without that step.

baka kaba
Jul 19, 2003

PLEASE ASK ME, THE SELF-PROFESSED NO #1 PAUL CATTERMOLE FAN IN THE SOMETHING AWFUL S-CLUB 7 MEGATHREAD, TO NAME A SINGLE SONG BY HIS EXCELLENT NU-METAL SIDE PROJECT, SKUA, AND IF I CAN'T PLEASE TELL ME TO
EAT SHIT

Java code:
String formatString = "PI is totally  %.4f and \nhere is a kirby: %s";
System.out.print(String.format(formatString, 3.160943f, "(>'_')>"));

Success	time: 0.04 memory: 4386816 signal:0
PI is totally  3.1609 and 
here is a kirby: (>'_')>
Do you mean something else? Got some code?
(Also you can use %n as a platform-specific line break character)

Loezi
Dec 18, 2012

Never buy the cheap stuff

baka kaba posted:

(Also you can use %n as a platform-specific line break character)


:eyepop: I've spent so much time cursing line.separator and never even considered there could be a better way.

Adbot
ADBOT LOVES YOU

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

baka kaba posted:

(Also you can use %n as a platform-specific line break character)

:tviv:

I wish I knew this long ago

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