You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Learning Java Programming on Linux

Author (Read 24347 times)

0 Members and 1 Guest are viewing this topic.

Re: Learning Java Programming on Linux
« Reply #17 on: July 30, 2017, 04:42:49 AM »
 

bitsnpcs

  • Platinum Level Poster
  • **********
  • 3237
    Posts
  • Reputation: 305
    • View Profile
    • Try to Grow

  • Kernel: 4.x
@Homework glad to pass the help along, @torreydale recommended to me.
I also use darker theme, is called monokai-extended. I find the coloured codes very helpful too :)
Great work, keep up your lessons ;)
 

Re: Learning Java Programming on Linux
« Reply #16 on: July 30, 2017, 02:30:27 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
@bitsnpcs Yes, I've been using gedit for 2 lessons now and the coloured codes are very useful in helping me to differentiate between the texts. I've chosen a darker colour scheme on gedit so it's easier on my eyes. Thanks very much for the recommendation! :D
 

Re: Learning Java Programming on Linux
« Reply #15 on: July 26, 2017, 12:29:59 PM »
 

torreydale

  • PayPal Supporter
  • Platinum Level Poster
  • *****
  • 1588
    Posts
  • Reputation: 261
  • * Forum Moderator *
    • View Profile

  • CPU: Intel i5-3230M (4) @ 3.200GHz

  • MEMORY: 16Gb

  • VIDEO CARD: Intel 3rd Gen Core processor Graphics

  • Kernel: 5.x
@bitsnpcs is correct.  I don't think Leafpad, the default text editor, is going to be sufficient for coding.  Gedit or Geany (if you need column mode) are going to be better for you.
Want to thank me?  Click my [Thank] link.
 

Re: Learning Java Programming on Linux
« Reply #14 on: July 26, 2017, 10:45:51 AM »
 

bitsnpcs

  • Platinum Level Poster
  • **********
  • 3237
    Posts
  • Reputation: 305
    • View Profile
    • Try to Grow

  • Kernel: 4.x
Do you find gedit okay for your needs ?

@torreydale told me about gedit

You can use custom templates, I use one, it helped me to like the gedit a lot more as the colours were easier for me, @LL-user  showed me how to install it in this thread  https://www.linuxliteos.com/forums/coding/beginning-with-python/msg29409/#msg29409
 

Re: Learning Java Programming on Linux
« Reply #13 on: July 26, 2017, 10:21:07 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
Just realised I made a mistake with the codes while I was re-watching the tutorial and trying out gedit.
The erroneous code:
Code: [Select]
Name myName = new Name("Cookie" + "Monster" + "Jr");

The correct code:
Code: [Select]
Name myName = new Name("Cookie", "Monster", "Jr");
Programming really puts attention to details to the test.
Thank you to everyone who responded and mulled over this issue (when it's due to my carelessness, sorry!!).
 

Re: Learning Java Programming on Linux
« Reply #12 on: July 25, 2017, 11:32:37 PM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
I have no idea if that is the problem, but the text editor I use (Leafpad) has an option to set the required line terminator to CRLF or just LF. I can only suggest trying it as I do not use Java.

Hi justme2, Lite's text editor has this option too but it did not work for me. Thanks for suggesting it though.

Hello,
I use the gedit and terminal for the Python book I use, I had a look on Google it says gedit can be used for Java with the terminal.

I think they call it ethical because it is legal like pentesting.


Thanks bitsnpcs, I'll install gedit later this evening and try it out.
 

Re: Learning Java Programming on Linux
« Reply #11 on: July 25, 2017, 08:02:14 PM »
 

bitsnpcs

  • Platinum Level Poster
  • **********
  • 3237
    Posts
  • Reputation: 305
    • View Profile
    • Try to Grow

  • Kernel: 4.x
Hello,
I use the gedit and terminal for the Python book I use, I had a look on Google it says gedit can be used for Java with the terminal.

I think they call it ethical because it is legal like pentesting.
« Last Edit: July 25, 2017, 10:43:34 PM by bitsnpcs »
 

Re: Learning Java Programming on Linux
« Reply #10 on: July 25, 2017, 03:41:50 PM »
 

justme2

  • PayPal Supporter
  • Forum Regular
  • *****
  • 201
    Posts
  • Reputation: 25
  • Linux Lite Member
    • View Profile

  • CPU: Intel i5 vPro

  • MEMORY: 8Gb

  • VIDEO CARD: Intel
I'm not familiar with java either, but one thing springs to mind - I think windows and linux use different line terminators in text editors, CRLF and LF.  Could that be the problem?

Hello justme2, thank you for pointing out the difference!
So I found this article: https://blog.codinghorror.com/the-great-newline-schism/, unfortunately I'm still none the wiser on how this would affect Lite text editor processing the empty spaces.

Windows text editor save encoding as ANSI, while Lite text editor save encoding as UTF-8. Could this be the reason for this problem?

I have no idea if that is the problem, but the text editor I use (Leafpad) has an option to set the required line terminator to CRLF or just LF. I can only suggest trying it as I do not use Java.
1) Lenovo T520 i5 LL3.8 8GB ram, fast & stable
2) Medion P4 32bit LL3.8 1GB ram, quite fast & stable
3) eeePC 901 32bit LL3.8 1GB ram, fast & stable
4) eeePC 701 32bit LL3.8 1GB ram, slower & stable but small and light enough to travel with me to New Zealand when visiting family in Blenheim.
 

Re: Learning Java Programming on Linux
« Reply #9 on: July 25, 2017, 11:19:29 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
I'm not familiar with java either, but one thing springs to mind - I think windows and linux use different line terminators in text editors, CRLF and LF.  Could that be the problem?

Hello justme2, thank you for pointing out the difference!
So I found this article: https://blog.codinghorror.com/the-great-newline-schism/, unfortunately I'm still none the wiser on how this would affect Lite text editor processing the empty spaces.

Windows text editor save encoding as ANSI, while Lite text editor save encoding as UTF-8. Could this be the reason for this problem?
 

Re: Learning Java Programming on Linux
« Reply #8 on: July 25, 2017, 10:29:15 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
Giving it a quick look... The part listed...
Code: [Select]
new Name("Cookie" + "Monster" + "Jr")Although you have spacing between " + there isn't any coded spaces..


Maybe try, see if it results properly
Code: [Select]
new Name("Cookie " + "Monster " + "Jr")

Hello firenice03, thank you for your suggestion. It did work, but there are still extra empty spaces that appeared in front of the name due to the toString method.
newName is supposed to appear as indicated by the toString method which has a space in between first, middle, and last name. The idea of the exercise is to to input each name alone without any spaces just like anyone filling up a field on a form etc., that's why toString method is used.
There are two Java files and they both worked together, and here's the first set of code (called Name.java) that sets the foundation (if that's how programmer(s) put it?):
Code: [Select]
public class Name
{
private String first;
private String middle;
private String last;

// constructor methods allow us to declare class objects and provide those objects with some data.
public Name(String f, String m, String l)
{
first = f;
middle = m;
last = l;
}

public Name(String f, String l)
{
first = f;
middle = "";
last = l;
}

public Name(String l)
{
first = "";
middle = "";
last = l;
}

//default constructor - it's a good idea to add one that doesn't have data in them
public Name()
{
first = "";
middle = "";
last = "";
}

public String toString()
{
return first + " " + middle + " " + last;
}
}

And here's the other file that has the data called NameTest.java:
Code: [Select]
public class NameTest
{
public static void main(String[] args)
{
// instantiation - creating an instance of the Name class
Name myName = new Name("Cookie" + "Monster" + "Jr");
Name yourName = new Name("Great" + "Cookie");
Name aName = new Name("Durr");
System.out.println("myName: " + myName.toString());
System.out.println("yourName: " + yourName.toString());
}
}

NameTest.java would not work without Name.java. These are the two files in their entirety. Hope this would give clarity to what the codes are supposed to do.
 

Re: Learning Java Programming on Linux
« Reply #7 on: July 25, 2017, 10:10:58 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
I looked at the Udemy where you learn, I liked the beginners Ethical Hacker course contents, it is not free though.

My cousin was sponsored by her company to take this course recently, and we have a laugh at it thinking how is hacking ever ethical!  ;D
But jokes aside, my course isn't free as well......
 

Re: Learning Java Programming on Linux
« Reply #6 on: July 24, 2017, 03:53:06 PM »
 

justme2

  • PayPal Supporter
  • Forum Regular
  • *****
  • 201
    Posts
  • Reputation: 25
  • Linux Lite Member
    • View Profile

  • CPU: Intel i5 vPro

  • MEMORY: 8Gb

  • VIDEO CARD: Intel
I'm not familiar with java either, but one thing springs to mind - I think windows and linux use different line terminators in text editors, CRLF and LF.  Could that be the problem?
« Last Edit: July 24, 2017, 03:54:45 PM by justme2 »
1) Lenovo T520 i5 LL3.8 8GB ram, fast & stable
2) Medion P4 32bit LL3.8 1GB ram, quite fast & stable
3) eeePC 901 32bit LL3.8 1GB ram, fast & stable
4) eeePC 701 32bit LL3.8 1GB ram, slower & stable but small and light enough to travel with me to New Zealand when visiting family in Blenheim.
 

Re: Learning Java Programming on Linux
« Reply #5 on: July 24, 2017, 01:29:46 PM »
 

firenice03

  • Rockin' the FREE World
  • Global Moderator
  • Platinum Level Poster
  • *****
  • 1848
    Posts
  • Reputation: 284
  • Linux Lite Member
    • View Profile

  • CPU: AMD E2//Atom X5//AMD Phenom II X2

  • MEMORY: 4Gb

  • VIDEO CARD: AMD Mullin Radeon R2//Intel//AMD/ATI RS880

  • Kernel: 5.x
Giving it a quick look... The part listed...
Code: [Select]
new Name("Cookie" + "Monster" + "Jr")Although you have spacing between " + there isn't any coded spaces..


Maybe try, see if it results properly
Code: [Select]
new Name("Cookie " + "Monster " + "Jr")
LL4.8 UEFI 64 bit ASUS E402W - AMD E2 (Quad) 1.5Ghz  - 4GB - AMD Mullins Radeon R2
LL5.8 UEFI 64 bit Test UEFI Kangaroo (Mobile Desktop) - Atom X5-Z8500 1.44Ghz - 2GB - Intel HD Graphics
LL4.8 64 bit HP 6005- AMD Phenom II X2 - 8GB - AMD/ATI RS880 (HD4200)
LL3.8 32 bit Dell Inspiron Mini - Atom N270 1.6Ghz - 1GB - Intel Mobile 945GSE Express  -- Shelved
BACK LL5.8 64 bit Dell Optiplex 160 (Thin) - Atom 230 1.6Ghz - 4GB-SiS 771/671 PCIE VGA - Print Server
Running Linux Lite since LL2.2
 

Re: Learning Java Programming on Linux
« Reply #4 on: July 24, 2017, 10:34:54 AM »
 

bitsnpcs

  • Platinum Level Poster
  • **********
  • 3237
    Posts
  • Reputation: 305
    • View Profile
    • Try to Grow

  • Kernel: 4.x
Hello Homework,

Hopefully someone will answer you soon about this. :)
Linux Lite is more stable than Windows, it will be good for your course learning, once the issue is solved.

I looked at the Udemy where you learn, I liked the beginners Ethical Hacker course contents, it is not free though.
 

Re: Learning Java Programming on Linux
« Reply #3 on: July 24, 2017, 08:42:23 AM »
 

Homework

  • New to Forums
  • *
  • 16
    Posts
  • Reputation: 2
  • Linux Lite Member
    • View Profile

  • CPU: Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz

  • MEMORY: 6Gb
Hello bitsnpcs, thank you so much for replying to almost all my posts.
Unfortunately this error message appeared when I tried changing the position of the semicolon:
Code: [Select]
Name.java:39: error: ';' expected
return first + " " + middle + " " + last
                                        ^
1 error

This course is conducted using Windows OS, notepad, and CMD. Since my Windows OS crashed unexpectedly, I decided to carry on the course on Linux Lite. There are other web resources out there that recommended Vim, emacs or DrJava to learn Java on Linux platform, so I just want to confirm if this issue is really because I'm using Lite's text editor.
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section