Results 1 to 6 of 6
  1. #1
    Bapelsin is offline Member
    Join Date
    Mar 2017
    Posts
    2
    Rep Power
    0

    Red face use sftp+mysql in a program

    Hi!
    I'm gonna try to write my first "real" program after completing the hello world stuff.

    The target machine (red hat with java 1.6 installed) will use crontab and call my program once a day.

    The program should query a mysql database and upload the resulting data/file with sftp to another server.

    I am a total noob on java, if this was php i would use "composer" to load mysql and sftb-libs to use - i guess maybe maven is what i should use in the java world? Or are there better options?
    Is it possible to bundle my program into one big jar or do i have to publish lots of small files? I use intellij ultimate.
    Thanks

  2. #2
    benji2505 is offline Senior Member
    Join Date
    Sep 2014
    Location
    MA, USA
    Posts
    384
    Rep Power
    4

    Default Re: use sftp+mysql in a program

    Your compiled program will be one executable jar file if you create a desktop program. Maven sounds like overkill to me for 2 external libraries. You might as well import them into the project via IntelliJ.

  3. #3
    gozzy is offline Member
    Join Date
    Jan 2017
    Posts
    46
    Rep Power
    0

    Default Re: use sftp+mysql in a program

    Your compiled program will be one executable jar file if you create a desktop program.
    Yes, but only if you create a 'fat jar'. The MySql driver occupies a jar of its own so it you want to distribute a dependency-free 'executable' then that needs to be assimilated into that executable. Fairly ambitious in all for your first non-HelloWorld ;)

  4. #4
    SurfMan's Avatar
    SurfMan is offline Godlike
    Join Date
    Nov 2012
    Location
    The Netherlands
    Posts
    1,951
    Rep Power
    7

    Default Re: use sftp+mysql in a program

    Try the easy way first: create your program using external jars as libraries that you put on the application's classpath. Create a user on your Linux box specifically for this purpose, put the jars in a directory in the home directory, and run it with cron.
    "It's not fixed until you stop calling the problem weird and you understand what was wrong." - gimbal2 2013

  5. #5
    Bapelsin is offline Member
    Join Date
    Mar 2017
    Posts
    2
    Rep Power
    0

    Default Re: use sftp+mysql in a program

    Thanks for the advice.
    After a few trial-and-errors I managed to get it to work by uploading a couple of files to the server.
    Maven wouldn't have it when I tried to compile everything into one jar. I think i managed to get everything in my intellijproject to target java 1.6 in which maven wasn't compatible.

  6. #6
    gozzy is offline Member
    Join Date
    Jan 2017
    Posts
    46
    Rep Power
    0

    Default Re: use sftp+mysql in a program

    A fat jar is called 'shade' in Maven

Similar Threads

  1. Replies: 2
    Last Post: 05-16-2014, 09:15 AM
  2. running program on sftp server not working
    By hardcorebadger in forum New To Java
    Replies: 9
    Last Post: 01-14-2011, 02:59 PM
  3. SFTP applet (SSH FTP)
    By jfileupload in forum Java Software
    Replies: 1
    Last Post: 02-26-2009, 10:31 PM
  4. Replies: 2
    Last Post: 06-12-2008, 07:09 AM
  5. Rad SFTP Applet 2.01
    By levent in forum Java Software
    Replies: 0
    Last Post: 05-22-2007, 06:59 AM

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
  •