Execute a command without thread

Hi....i have to execute a command in DOS and i'm using runtime java class with its method exec(). The process works perfectly but in my code i have to execute that command without a thread because the successive operations will work only if the command terminated correctly. What can i do to resolve it?

String cmd = input.getTxtDb2Cmd();
Process p = Runtime.getRuntime().exec(cmd);
int r = p.waitFor();
if (r != 0)
throw new RuntimeException("db2 command failed");
i've to invoke a db2 command that import a txt file in a db table. After this code i've some operations that works with this table so i've to terminate this import before execute other functions.

Similar Messages

  • Executing client commands without using webutil

    Hi,
    Overview: Our dba is busy enough to be disturbed for configuring webutil for me to execute client commands like client_host, client_text_io, etc.
    The forms resides on unix server, then I want to implement a feature that writes data to a file then to be saved in the client's
    local directory.
    Question: I was just wondering if I can or is it possible to execute client commands specifically windows commands without using client_host?
    Any help would be much appreciated.

    I think i found a way on how to do it, using Runtime.getRuntime().exec

  • Execute DOS command from java application

    Hello,
    I want to execute a DOS command (MOVE, in order to move an image from a folder to an other) from a java application. How can I do this?
    Francesco

    Yes I have tested it and it is working but only when executing a bacth file. For instance:
    Runtime rt = Runtime.getRuntime();
    try{
         Process proc = rt.exec("move.bat");
    }catch(Exception ex){
         ex.printStackTrace();
    }and the command in move.bat is:
    move c:\\temp\\*.gif C:\\temp2
    You don't have to use double slashes in batch files, only in Java. But anyway it is working both ways.
    It is not working when you try to execute the command without the batch file:
    Process proc = rt.exec("move c:\\temp\\*.gif C:\\temp2"); -> this will not work.
    It should work. Try to execute another command to see what happens.

  • EXECUTE DOS COMMANDS WITH JAVA

    I'm new to java and I want to execute dos commands by java
    can someone help me by by anyway?
    like tell me the packages or methods I need
    or give me links to sites?
    thanks

    No Arguments:
    try {
            // Execute a command without arguments
            String command = "ls";
            Process child = Runtime.getRuntime().exec(command);
            // Execute a command with an argument
            command = "ls /tmp";
            child = Runtime.getRuntime().exec(command);
        } catch (IOException e) {
        }With Arguments:
    try {
            // Execute a command with an argument that contains a space
            String[] commands = new String[]{"grep", "hello world", "/tmp/f.txt"};
            commands = new String[]{"grep", "hello world", "c:\\Documents and Settings\\f.txt"};
            Process child = Runtime.getRuntime().exec(commands);
        } catch (IOException e) {
        }

  • DP Execution-Execute a DP without supplying value for command line argument

    DP Execution - How to execute a DP without supplying value for a command line argument?
    My requirement is like Directive should have an optional command line argument.
    i.e., even if the value is not supplied for the command line arg, my DP should run.
    Your help is appreciable.

    What is DP?
    What is Directive?

  • How to execute a command periodically?

    hi
    well it may seems so silly to ask such question ,but i am a beginner.
    I want to execute a command ,i mean printing some text every five minutes without any loop.I mean using some kind of interrupt or so.So my processor has got time to do other jobs.
    I would be glad if anybody could give me a clue,so i know where to start from.
    BRs
    saeed
    Edited by: zaec on Oct 27, 2008 1:54 AM

    But I have got another problem ,suppose I have got 3 different threads which are going to be done as follow:
    thread one-----every 5 seconds
    thread two-----every 7 seconds
    thread three--every 10 seconds
    Now ,if thread one,as an example,take more than 10 secondsand by now thread 2 has passed its 7 second what happens.does thread 1 stops at its 7 seconds and thread 2 starts,or thread 1 doesnot give the control to anyother thread till it is finished.By the way i use sleep() method to give the control to other threads.
    sleep looks like a good way to ensure that other threads get a chance to execute.
    As for what happens to concurrent threads when a particular thread is running -- as far as I understand, Java machine specification does not mandate strict "rules of the game" here. I wouldn't be surprised if things differ on different devices.
    More details on multi threading in Java are available in 9-part series of articles in Java World: *"Programming Java threads in the real world"*. You can find these articles with search at Java World site: [click here for search results|http://www.javaworld.com/ifind/java/query.html?col=java&qt=Programming+Java+threads+in+the+real+world]

  • [Solved] "slim: failed to execute login command" after awesomewm updat

    Hi,
    i updated some weeks ago via pacman -Syu, where also awesome wm was updated from 3.4.* to 3.5.* so I updated my rc.lua as it is told on their wiki, but i cant login with my rc.lua anymore i got the failed to execute login command error from slime. If i use the shipped efault rc.lua it works fine, can someone help me to figure out whats wrong with my rc.lua?
    -- Standard awesome library
    local gears = require("gears")
    local awful = require("awful")
    awful.rules = require("awful.rules")
    require("awful.autofocus")
    -- Widget and layout library
    local wibox = require("wibox")
    -- Theme handling library
    local beautiful = require("beautiful")
    -- Notification library
    local naughty = require("naughty")
    local menubar = require("menubar")
    local vicious = require("vicious")
    function fullscreens(c)
    awful.client.floating.toggle(c)
    if awful.client.floating.get(c) then
    local clientX = screen[1].workarea.x
    local clientY = screen[1].workarea.y
    local clientWidth = 0
    -- look at http://www.rpm.org/api/4.4.2.2/llimits_8h-source.html
    local clientHeight = 2147483640
    for s = 1, screen.count() do
    clientHeight = math.min(clientHeight, screen[s].workarea.height)
    clientWidth = clientWidth + screen[s].workarea.width
    end
    local t = c:geometry({x = clientX, y = clientY, width = clientWidth, height = clientHeight})
    else
    --apply the rules to this client so he can return to the right tag if there is a rule for that.
    awful.rules.apply(c)
    end
    -- focus our client
    client.focus = c
    end
    -- {{{ Error handling
    -- Check if awesome encountered an error during startup and fell back to
    -- another config (This code will only ever execute for the fallback config)
    if awesome.startup_errors then
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, there were errors during startup!",
    text = awesome.startup_errors })
    end
    -- Handle runtime errors after startup
    do
    local in_error = false
    awesome.connect_signal("debug::error", function (err)
    -- Make sure we don't go into an endless error loop
    if in_error then return end
    in_error = true
    naughty.notify({ preset = naughty.config.presets.critical,
    title = "Oops, an error happened!",
    text = err })
    in_error = false
    end)
    end
    -- {{{ Variable definitions
    -- Themes define colours, icons, and wallpapers
    -- beautiful.init("/home/kili/Repositories/awesome-themes/arch/theme.lua")
    beautiful.init("/usr/share/awesome/themes/default/theme.lua")
    -- This is used later as the default terminal and editor to run.
    terminal = "urxvt"
    editor = os.getenv("EDITOR") or "nano"
    editor_cmd = terminal .. " -e " .. editor
    -- Default modkey.
    -- Usually, Mod4 is the key with a logo between Control and Alt.
    -- If you do not like this or do not have such a key,
    -- I suggest you to remap Mod4 to another key using xmodmap or other tools.
    -- However, you can use another modifier like Mod1, but it may interact with others.
    modkey = "Mod4"
    -- Table of layouts to cover with awful.layout.inc, order matters.
    layouts =
    awful.layout.suit.tile,
    awful.layout.suit.tile.left,
    awful.layout.suit.tile.bottom,
    awful.layout.suit.tile.top,
    awful.layout.suit.floating,
    awful.layout.suit.fair,
    awful.layout.suit.fair.horizontal,
    awful.layout.suit.spiral,
    awful.layout.suit.spiral.dwindle,
    awful.layout.suit.max,
    awful.layout.suit.max.fullscreen,
    awful.layout.suit.magnifier
    -- {{{ Tags
    -- Define a tag table which hold all screen tags.
    tags = {}
    for s = 1, screen.count() do
    -- Each screen has its own tag table.
    tags[s] = awful.tag({ 1, 2, 3, 4, 5}, s, layouts[1])
    end
    -- {{{ Menu
    -- Create a laucher widget and a main menu
    myawesomemenu = {
    { "manual", terminal .. " -e man awesome" },
    { "edit config", editor_cmd .. " " .. awesome.conffile },
    { "restart", awesome.restart },
    { "quit", awesome.quit }
    mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
    { "open terminal", terminal }
    mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
    -- {{{ Wibox
    -- Create a textclock widget
    batwidget = wibox.widget.textbox()
    vicious.register(batwidget, vicious.widgets.bat,
    function(widget,args)
    local formatstring = " Bat: "..args[1]..args[2] .."%".. " "..args[3] .. " "
    if args[2] <= 25 and args[1] == "-" then
    return "<span color=\"red\">".. formatstring .. "</span>"
    end
    return formatstring
    end, 60, "BAT0")
    netwidgetETH = wibox.widget.textbox()
    netwidgetWIFI = wibox.widget.textbox()
    vicious.register(netwidgetETH, vicious.widgets.net, ' eth0:<span color="#CC9393">${eth0 down_kb}</span> <span color="#7F9F7F">${eth0 up_kb}</span>', 3)
    vicious.register(netwidgetWIFI, vicious.widgets.net,' wlan0:<span color="#CC9393">${wlan0 down_kb}</span> <span color="#7F9F7F">${wlan0 up_kb}</span>', 3)
    menubar.utils.terminal = terminal
    mytextclock = awful.widget.textclock()--{ align = "right" })
    -- Create a systray
    mysystray = wibox.widget.systray()
    -- Create a wibox for each screen and add it
    mywibox = {}
    mypromptbox = {}
    mylayoutbox = {}
    mytaglist = {}
    mytaglist.buttons = awful.util.table.join(
    awful.button({ }, 1, awful.tag.viewonly),
    awful.button({ modkey }, 1, awful.client.movetotag),
    awful.button({ }, 3, awful.tag.viewtoggle),
    awful.button({ modkey }, 3, awful.client.toggletag),
    awful.button({ }, 4, function(t) awful.tag.viewnext(aweful.tag.getscreen(t)) end),
    awful.button({ }, 5, function(t) awful.tag.viewprev(aweful.tag.getscreen(t)) end)
    mytasklist = {}
    mytasklist.buttons = awful.util.table.join(
    awful.button({ }, 1, function (c)
    if c == client.focus then
    c.minimized = true
    else
    c.minimized = false
    if not c:isvisible() then
    awful.tag.viewonly(c:tags()[1])
    end
    -- This will also un-minimize
    -- the client, if needed
    client.focus = c
    c:raise()
    end
    end),
    awful.button({ }, 3, function ()
    if instance then
    instance:hide()
    instance = nil
    else
    instance = awful.menu.clients({ width=250 })
    end
    end),
    awful.button({ }, 4, function ()
    awful.client.focus.byidx(1)
    if client.focus then client.focus:raise() end
    end),
    awful.button({ }, 5, function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end))
    for s = 1, screen.count() do
    -- Create a promptbox for each screen
    mypromptbox[s] = awful.widget.prompt()--{ layout = awful.widget.layout.horizontal.leftright })
    -- Create an imagebox widget which will contains an icon indicating which layout we're using.
    -- We need one layoutbox per screen.
    mylayoutbox[s] = awful.widget.layoutbox(s)
    mylayoutbox[s]:buttons(awful.util.table.join(
    awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
    awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
    awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
    -- Create a taglist widget
    mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
    -- Create a tasklist widget
    mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
    -- Create the wibox
    mywibox[s] = awful.wibox({ position = "top", screen = s })
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(mylauncher)
    left_layout:add(mytaglist[s])
    left_layout:add(mypromptbox[s])
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    if s == 1 then right_layout:add(wibox.widget.systray()) end
    right_layout:add(netwidgetWIFI)
    right_layout:add(netwidgetETH)
    right_layout:add(batwidget)
    right_layout:add(mytextclock)
    right_layout:add(mylayoutbox[s])
    -- Now bring it all together (with the tasklist in the middle)
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_middle(mytasklist[s])
    layout:set_right(right_layout)
    mywibox[s]:set_widget(layout)
    -- Add widgets to the wibox - order matters
    --mywibox[s].widgets = {
    -- mylauncher,
    -- mytaglist[s],
    -- mypromptbox[s],
    --layout = awful.widget.layout.horizontal.leftright
    -- mylayoutbox[s],
    -- mytextclock,
    -- batwidget,
    -- netwidgetETH,
    -- netwidgetWIFI,
    -- s == 1 and mysystray or nil,
    -- mytasklist[s],
    -- layout = awful.widget.layout.horizontal.rightleft
    end
    -- {{{ Mouse bindings
    root.buttons(awful.util.table.join(
    awful.button({ }, 3, function () mymainmenu:toggle() end),
    awful.button({ }, 4, awful.tag.viewnext),
    awful.button({ }, 5, awful.tag.viewprev)
    -- {{{ Key bindings
    globalkeys = awful.util.table.join(
    awful.key({ modkey, }, "Left", awful.tag.viewprev ),
    awful.key({ modkey, }, "Right", awful.tag.viewnext ),
    awful.key({ modkey, }, "Escape", awful.tag.history.restore),
    awful.key({ modkey, }, "j",
    function ()
    awful.client.focus.byidx( 1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "k",
    function ()
    awful.client.focus.byidx(-1)
    if client.focus then client.focus:raise() end
    end),
    awful.key({ modkey, }, "w", function () mymainmenu:show() end),
    -- Layout manipulation
    awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end),
    awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end),
    awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end),
    awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end),
    awful.key({ modkey, }, "u", awful.client.urgent.jumpto),
    awful.key({ modkey, }, "Tab",
    function ()
    awful.client.focus.history.previous()
    if client.focus then
    client.focus:raise()
    end
    end),
    -- Standard program
    awful.key({ modkey, }, "Return", function () awful.util.spawn(terminal) end),
    awful.key({ modkey, "Control" }, "r", awesome.restart),
    awful.key({ modkey, "Shift" }, "q", awesome.quit),
    awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end),
    awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end),
    awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1) end),
    awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1) end),
    awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1) end),
    awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1) end),
    awful.key({ modkey, }, "space", function () awful.layout.inc(layouts, 1) end),
    awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(layouts, -1) end),
    awful.key({ modkey, "Control" }, "n", awful.client.restore),
    -- Prompt
    awful.key({ modkey }, "r", function () mypromptbox[mouse.screen]:run() end),
    awful.key({ modkey }, "x",
    function ()
    awful.prompt.run({ prompt = "Run Lua code: " },
    mypromptbox[mouse.screen].widget,
    awful.util.eval, nil,
    awful.util.getdir("cache") .. "/history_eval")
    end),
    -- Multimedia
    awful.key({ }, "XF86AudioLowerVolume", function () awful.util.spawn("amixer -q sset Master 2dB-") end),
    awful.key({ }, "XF86AudioRaiseVolume", function () awful.util.spawn("amixer -q sset Master 2dB+") end),
    awful.key({ }, "XF86AudioNext",function () awful.util.spawn( "mocp -f" ) end),
    awful.key({ }, "XF86AudioPrev",function () awful.util.spawn( "mocp -r" ) end),
    awful.key({ }, "XF86AudioPlay",function () awful.util.spawn( "mocp -G" ) end),
    awful.key({ }, "Print", function () awful.util.spawn("ksnapshot") end),
    awful.key({ }, "", function () awful.util.spawn("slimlock") end)
    clientkeys = awful.util.table.join(
    awful.key({ modkey, }, "f", function (c) c.fullscreen = not c.fullscreen end),
    awful.key({ modkey, "Shift" }, "c", function (c) c:kill() end),
    awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ),
    awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end),
    awful.key({ modkey, }, "o", awful.client.movetoscreen ),
    -- awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end),
    awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end),
    awful.key({ modkey, }, "n",
    function (c)
    -- The client currently has the input focus, so it cannot be
    -- minimized, since minimized clients can't have the focus.
    c.minimized = true
    end),
    awful.key({ modkey, }, "m",
    function (c)
    c.maximized_horizontal = not c.maximized_horizontal
    c.maximized_vertical = not c.maximized_vertical
    end),
    awful.key({ modkey, "Shift" }, "f", fullscreens)
    -- Compute the maximum number of digit we need, limited to 9
    keynumber = 0
    for s = 1, screen.count() do
    keynumber = math.min(9, math.max(#tags[s], keynumber))
    end
    -- Bind all key numbers to tags.
    -- Be careful: we use keycodes to make it works on any keyboard layout.
    -- This should map on the top row of your keyboard, usually 1 to 9.
    for i = 1, keynumber do
    globalkeys = awful.util.table.join(globalkeys,
    awful.key({ modkey }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewonly(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Control" }, "#" .. i + 9,
    function ()
    local screen = mouse.screen
    if tags[screen][i] then
    awful.tag.viewtoggle(tags[screen][i])
    end
    end),
    awful.key({ modkey, "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.movetotag(tags[client.focus.screen][i])
    end
    end),
    awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
    function ()
    if client.focus and tags[client.focus.screen][i] then
    awful.client.toggletag(tags[client.focus.screen][i])
    end
    end))
    end
    clientbuttons = awful.util.table.join(
    awful.button({ }, 1, function (c) client.focus = c; c:raise() end),
    awful.button({ modkey }, 1, awful.mouse.client.move),
    awful.button({ modkey }, 3, awful.mouse.client.resize))
    -- Set keys
    root.keys(globalkeys)
    -- Set Firefox to always map on tags number 2 of screen 1.
    -- { rule = { class = "Firefox" },
    -- properties = { tag = tags[1][2] } },
    -- {{{ Rules
    if screen.count() > 1 then
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    -- border_color = beautiful.border_normal,
    focus = true,
    keys = clientkeys,
    buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "gimp" },
    properties = { floating = true } },
    { rule = { class = "Xdialog" },
    properties = { floating = true } },
    { rule = { class = "Firefox" },
    properties = { tag = tags[1][1] } },
    { rule = { name = "Thunderbird" },
    properties = { tag = tags[1][2] } },
    { rule = { instance = "plugin-container" },
    properties = { floating = true } },
    { rule = { class = "Luakit" },
    properties = { floating = true } }
    else
    awful.rules.rules = {
    -- All clients will match this rule.
    { rule = { },
    properties = { border_width = beautiful.border_width,
    -- border_color = beautiful.border_normal,
    focus = true,
    keys = clientkeys,
    buttons = clientbuttons } },
    { rule = { class = "MPlayer" },
    properties = { floating = true } },
    { rule = { class = "gimp" },
    properties = { floating = true } },
    { rule = { class = "Firefox" },
    properties = { tag = tags[1][2] } },
    { rule = { name = "Thunderbird" },
    properties = { tag = tags[1][3] } },
    { rule = { instance = "plugin-container" },
    properties = { floating = true, fullscreen = true } },
    { rule = { class = "Dolphin" },
    properties = { floating = false, fullscreen = false, tag = tags[1][4] } },
    { rule = { class = "Luakit" },
    properties = { floating = true } },
    { rule = { class = "Pidgin" },
    properties = { tag = tags[1][5] } }
    end
    -- {{{ Signals
    -- Signal function to execute when a new client appears.
    client.connect_signal("manage", function (c, startup)
    -- Add a titlebar
    -- awful.titlebar.add(c, { modkey = modkey })
    -- Enable sloppy focus
    c:connect_signal("mouse::enter", function(c)
    if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
    and awful.client.focus.filter(c) then
    client.focus = c
    end
    end)
    if not startup then
    -- Set the windows at the slave,
    -- i.e. put it at the end of others instead of setting it master.
    -- awful.client.setslave(c)
    -- Put windows in a smart way, only if they does not set an initial position.
    if not c.size_hints.user_position and not c.size_hints.program_position then
    awful.placement.no_overlap(c)
    awful.placement.no_offscreen(c)
    end
    end
    local titlebars_enabled = false
    if titlebars_enabled and (c.type == "normal" or c.type == "dialog") then
    -- Widgets that are aligned to the left
    local left_layout = wibox.layout.fixed.horizontal()
    left_layout:add(awful.titlebar.widget.iconwidget(c))
    -- Widgets that are aligned to the right
    local right_layout = wibox.layout.fixed.horizontal()
    right_layout:add(awful.titlebar.widget.floatingbutton(c))
    right_layout:add(awful.titlebar.widget.maximizedbutton(c))
    right_layout:add(awful.titlebar.widget.stickybutton(c))
    right_layout:add(awful.titlebar.widget.ontopbutton(c))
    right_layout:add(awful.titlebar.widget.closebutton(c))
    -- The title goes in the middle
    local title = awful.titlebar.widget.titlewidget(c)
    title:buttons(awful.util.table.join(
    awful.button({ }, 1, function()
    client.focus = c
    c:raise()
    awful.mouse.client.move(c)
    end),
    awful.button({ }, 3, function()
    client.focus = c
    c:raise()
    awful.mouse.client.resize(c)
    end)
    -- Now bring it all together
    local layout = wibox.layout.align.horizontal()
    layout:set_left(left_layout)
    layout:set_right(right_layout)
    layout:set_middle(title)
    awful.titlebar(c):set_widget(layout)
    end
    end)
    client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
    client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
    Here is also my slime config and my initrc
    ls -lisa .xinitrc
    3276814 4 -rwxr-xr-x ...
    #!/bin/sh
    xrdb -merge ~/.Xresources
    wicd-client --tray &
    exec awesome #>> ~/.cache/awesome/stdout 2>> ~/.cache/awesome/stderr
    # Path, X server and arguments (if needed)
    # Note: -xauth $authfile is automatically appended
    default_path /bin:/usr/bin:/usr/local/bin
    default_xserver /usr/bin/X
    xserver_arguments -nolisten tcp vt07
    # Commands for halt, login, etc.
    halt_cmd /sbin/shutdown -h now
    reboot_cmd /sbin/shutdown -r now
    console_cmd /usr/bin/xterm -C -fg white -bg black +sb -T "Console login" -e /bin/sh -c "/bin/cat /etc/issue; exec /bin/login"
    #suspend_cmd /usr/sbin/suspend
    # Full path to the xauth binary
    xauth_path /usr/bin/xauth
    # Xauth file for server
    authfile /var/run/slim.auth
    # Activate numlock when slim starts. Valid values: on|off
    numlock on
    # Hide the mouse cursor (note: does not work with some WMs).
    # Valid values: true|false
    # hidecursor false
    # This command is executed after a succesful login.
    # you can place the %session and %theme variables
    # to handle launching of specific commands in .xinitrc
    # depending of chosen session and slim theme
    # NOTE: if your system does not have bash you need
    # to adjust the command according to your preferred shell,
    # i.e. for freebsd use:
    # login_cmd exec /bin/sh - ~/.xinitrc %session
    login_cmd exec /bin/bash -login ~/.xinitrc %session
    # Commands executed when starting and exiting a session.
    # They can be used for registering a X11 session with
    # sessreg. You can use the %user variable
    # sessionstart_cmd some command
    # sessionstop_cmd some command
    # Start in daemon mode. Valid values: yes | no
    # Note that this can be overriden by the command line
    # options "-d" and "-nodaemon"
    # daemon yes
    # Available sessions (first one is the default).
    # The current chosen session name is replaced in the login_cmd
    # above, so your login command can handle different sessions.
    # see the xinitrc.sample file shipped with slim sources
    sessions awesome,xfce4,icewm-session,wmaker,blackbox
    # Executed when pressing F11 (requires imagemagick)
    screenshot_cmd import -window root /slim.png
    # welcome message. Available variables: %host, %domain
    welcome_msg Welcome to %host
    # Session message. Prepended to the session name when pressing F1
    # session_msg Session:
    # shutdown / reboot messages
    shutdown_msg The system is halting...
    reboot_msg The system is rebooting...
    # default user, leave blank or remove this line
    # for avoid pre-loading the username.
    default_user kili
    # Focus the password field on start when default_user is set
    # Set to "yes" to enable this feature
    focus_password yes
    # Automatically login the default user (without entering
    # the password. Set to "yes" to enable this feature
    #auto_login no
    # current theme, use comma separated list to specify a set to
    # randomly choose from
    current_theme archlinux-simplyblack
    # Lock file
    lockfile /var/lock/slim.lock
    # Log file
    logfile /var/log/slim.log
    Thanks in advance!
    Edit:
    Besides a lot of other errors the problem was the systray. It was created 2 times, now login works again. I figured that out via enabling logging for awesome in the xinitrc again.
    Last edited by stubb (2013-01-08 23:20:05)

    Hi,
    I have the same kind of issue after updated slim from v1.3.4-4 to v1.3.5-1.
    see my topic  here :
    https://bbs.archlinux.org/viewtopic.php?id=156792
    Last edited by cedricl (2013-01-24 17:16:42)

  • Error while executing jdbc commands but getting connection pool

    I was not able to make a simple oracle connection and that hurts me.
    The program(jsp) is...
    <%@ page language="java" import="java.sql.*,java.io.*,
    java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
    <html>
    <body>
    <%
    Context ctx= new InitialContext();
    DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
    Connection conn=dsindogulf1.getConnection();
    if(conn!=null)
    System.out.println(conn.toString());
    else
    System.out.println("sorry");
    Statement st=conn.createStatement();
    String string1="CREATE TABLE Authorr(col1 CHAR(10));";
    st.executeUpdate(string1);
    %>
    </body>
    </html>
    If i delete the
    st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
    st.executeUpdate(string1); there is an error which i cannot understand.. the error is
    Error 500--Internal Server Error
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
         at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
         at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
         at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
         at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
         at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
         at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
         at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
         at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
    the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
    please help
    thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    babuli nayak wrote:
    I was not able to make a simple oracle connection and that hurts me.
    The program(jsp) is...
    <%@ page language="java" import="java.sql.*,java.io.*,
    java.util.*,pac1.*,javax.naming.*,javax.sql.*"%>
    <html>
    <body>
    <%
    Context ctx= new InitialContext();
    DataSource dsindogulf1=(DataSource)ctx.lookup("jnindogulf1");
    Connection conn=dsindogulf1.getConnection();
    if(conn!=null)
    System.out.println(conn.toString());
    else
    System.out.println("sorry");
    Statement st=conn.createStatement();
    String string1="CREATE TABLE Authorr(col1 CHAR(10));";
    st.executeUpdate(string1);
    %>
    </body>
    </html>
    If i delete the
    st.executeUpdate(string1); then there is no problem I get the connection pool. That means i am getting the connection. But when i include the
    st.executeUpdate(string1); there is an error which i cannot understand.. the error is
    Error 500--Internal Server Error
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-00911: invalid character
         at weblogic.jdbc.base.BaseExceptions.createException(Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(I[Ljava.lang.String;Ljava.lang.String;I)Ljava.sql.SQLException;(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.commonExecute()V(Optimized Method)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal()I(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdate(Ljava.lang.String;)I(Unknown Source)
         at weblogic.jdbc.wrapper.Statement.executeUpdate(Ljava.lang.String;)I(Statement.java:360)
         at jsp_servlet.__test._jspService(Ljavax.servlet.http.HttpServletRequest;Ljavax.servlet.http.HttpServletResponse;)V(__test.java:149)
         at weblogic.servlet.jsp.JspBase.service(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run()Ljava.lang.Object;(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;Lweblogic.servlet.internal.FilterChainImpl;)V(Optimized Method)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(Ljavax.servlet.ServletRequest;Ljavax.servlet.ServletResponse;)V(Optimized Method)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run()Ljava.lang.Object;(WebAppServletContext.java:6452)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Lweblogic.security.subject.AbstractSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(Optimized Method)
         at weblogic.security.service.SecurityManager.runAs(Lweblogic.security.acl.internal.AuthenticatedSubject;Lweblogic.security.acl.internal.AuthenticatedSubject;Ljava.security.PrivilegedAction;)Ljava.lang.Object;(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(Lweblogic.servlet.internal.ServletRequestImpl;Lweblogic.servlet.internal.ServletResponseImpl;)V(WebAppServletContext.java:3661)
         at weblogic.servlet.internal.ServletRequestImpl.execute(Lweblogic.kernel.ExecuteThread;)V(ServletRequestImpl.java:2630)
         at weblogic.kernel.ExecuteThread.execute(Lweblogic.kernel.ExecuteRequest;)V(ExecuteThread.java:219)
         at weblogic.kernel.ExecuteThread.run()V(ExecuteThread.java:178)
         at java.lang.Thread.startThreadFromVM(Ljava.lang.Thread;)V(Unknown Source)
    the steps which i have followed are... I have made a connection pool using weblogic type 4 driver in the administrative console... then i have created the data source using jndi name jnindogulf1..... but although i am getting the connection pool i am receiving error ehice executing jdbc commands
    please help
    thanks
    Hi. Remove the semicolon from your SQL string:     stmt.executeUpdate("CREATE TABLE Authorr(col1 CHAR(10))");Joe                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Executing UNIX command in Java

    I am having problems executing a command in Java. Here's the code I have for executing:
    Process p = Runtime.getRuntime().exec(cmd);
                                            BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
         while((display = input.readLine()) != null)
                             num_1 = Double.parseDouble(display);
                             percent = (num_1 * 100) / (50000000);
                        flip = 1;
                        catch(IOException e)
                        e.printStackTrace();     
                        System.exit(1);
    Now, when I run the script, I receive the following errors:
    Exception occurred during event dispatching:
    java.security.AccessControlException: access denied (java.io.FilePermission /Netadmin/UCDSNMP/bin/snmpdelta execute)
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at java.lang.Throwable.<init>(Compiled Code)
    at java.lang.Exception.<init>(Compiled Code)
    at java.lang.RuntimeException.<init>(RuntimeException.java:47)
    at java.lang.SecurityException.<init>(SecurityException.java:39)
    at java.security.AccessControlException.<init>(AccessControlException.java:57)
    at java.security.AccessControlContext.checkPermission(Compiled Code)
    at java.security.AccessController.checkPermission(Compiled Code)
    at java.lang.SecurityManager.checkPermission(Compiled Code)
    at java.lang.SecurityManager.checkExec(SecurityManager.java:789)
    at java.lang.Runtime.exec(Compiled Code)
    at java.lang.Runtime.exec(Compiled Code)
    at java.lang.Runtime.exec(Runtime.java:152)
    at snmp.actionPerformed(Compiled Code)
    at java.awt.Button.processActionEvent(Button.java:308)
    at java.awt.Button.processEvent(Button.java:281)
    at java.awt.Component.dispatchEventImpl(Compiled Code)
    at java.awt.Component.dispatchEvent(Compiled Code)
    at java.awt.EventQueue.dispatchEvent(Compiled Code)
    at java.awt.EventDispatchThread.pumpOneEvent(Compiled Code)
    at java.awt.EventDispatchThread.pumpEvents(Compiled Code)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)
    The user is entering the parameters for the UNIX command from a Java applet. Everything looks right, but I can't seem to run the file? Please help! All is appreciated.
    Jason Banks
    Northeastern University

    Sorry, this is a bug that I've reported -- see Sun's response and my original report (along with how to get around the problem) shown below:
    Hi Vira Van.,
    The bug you have reported is a duplicate of Bug ID: 4522533.
    Thank you for providing us with additional information
    that can be used in the resolution of this bug.
    This bug can be monitored via the the Java Developer
    Connection Bug Parade at:
    http://developer.java.sun.com/developer/bugParade/index.jshtml
    The Java Developer Connection is a free channel that is
    maintained by staff here at Sun.  Access this web page to join:
    http://developer.java.sun.com/servlet/RegistrationServlet
    The home page for the JDC is:
    http://java.sun.com/jdc
    Regards,
    Girish
    ----------------- Original Bug Report-------------------
    category : java
    release : 1.4
    subcategory : jar
    type : bug
    synopsis : signed applet: bad major version number on NN4.79 and ClassNotFound in IE5.5
    description : FULL PRODUCT VERSION :
    java version "1.4.0"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
    Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
    FULL OPERATING SYSTEM VERSION : Windows 98 [Version
    4.10.2222]
    ADDITIONAL OPERATING SYSTEMS :
    BROWSERS: Netscape Navigator 4.79
            : Internet Explorer 5.5
    EXTRA RELEVANT SYSTEM CONFIGURATION :
    Applet failed to start in Netscape, the following error
    message appeared in the Java Console:
    Netscape Communications Corporation -- Java 1.1.5
    Type '?' for options.
    Symantec Java! ByteCode Compiler Version 210.065
    Copyright (C) 1996-97 Symantec Corporation
    # Applet exception: error: java.lang.ClassFormatError: Bad
    major version number
    java.lang.ClassFormatError: Bad major version number
      at java.lang.ClassLoader.defineClass(Compiled Code)
      at netscape.applet.AppletClassLoader.findClass(Compiled
    Code)
      at netscape.applet.AppletClassLoader.loadClass1(Compiled
    Code)
    * at netscape.applet.AppletClassLoader.loadClass(Compiled
    Code)
      at netscape.applet.AppletClassLoader.loadClass(Compiled
    Code)
      at
    netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(
    Compiled Code)
      at
    java.awt.EventDispatchThread$EventPump.dispatchEvents(Compil
    ed Code)
      at java.awt.EventDispatchThread.run(Compiled Code)
      at
    netscape.applet.DerivedAppletFrame$AppletEventDispatchThread
    .run(Compiled Code)
    The same applet
    A DESCRIPTION OF THE PROBLEM :
    Unable to run signed applet with Netscape 4.79 and IE5.5
    native JVM.
    REGRESSION.  Last worked in version 1.3.1
    STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
    1.compile program and copy class files to a temp directory
    2.sign the applet for Netscape as follows:
    signtool -k aok -d \progra~1\netscape\users\viravan -Z
    FIO.jar temp
    3.sign the applet for Internet Explorer as follows:
    cabarc -p n FileIO.cab FileIO*.class
    setreg 1 true
    makecert -sk aok -n "CN=aok" aok.cer
    cert2spc aok.cer aok.spc
    signcode -j javasign.dll -jp LOWX -spc aok.spc -k aok
    FileIO.cab
    Run the applet with the following HTML file:
    <html><head><Title>Self-Signed Applet</Title>
    <script>
    document.layers ? parm=1 : parm=0;
    </script>
    <body>
    This file I/O applet lets you read and write to the user's
    local disk.<br>
    <br>
    <script>
    document.writeln('<APPLET CODE = "FileIO" CODEBASE = "."
    ARCHIVE = "FIO.jar" WIDTH = 10 HEIGHT = 10 NAME = "JSF">');
    document.writeln('<param name="Netscape"
    value="'+parm+'">');
    document.writeln('<param name="cabbase"
    value="FileIO.cab">');
    document.writeln('</APPLET>');
    </script>
    </body>
    </html>
    EXPECTED VERSUS ACTUAL BEHAVIOR :
    A frame with a textarea and some buttons should popup in the
    center of the screen.
    ERROR MESSAGES/STACK TRACES THAT OCCUR :
    Applet signed with signtool failed to start in Netscape, the following error
    message appeared in the Java Console:
    Netscape Communications Corporation -- Java 1.1.5
    Type '?' for options.
    Symantec Java! ByteCode Compiler Version 210.065
    Copyright (C) 1996-97 Symantec Corporation
    # Applet exception: error: java.lang.ClassFormatError: Bad major version number
    java.lang.ClassFormatError: Bad major version number
      at java.lang.ClassLoader.defineClass(Compiled Code)
      at netscape.applet.AppletClassLoader.findClass(Compiled Code)
      at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
    * at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
      at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
      at netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled Code)
      at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code)
      at java.awt.EventDispatchThread.run(Compiled Code)
      at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled
    Code)
    The same applet signed with signcode failed to start in Internet explorer, the
    error message in the Java Console is:
    Error loading class: FileIO
    java.lang.NoClassDefFoundError
    java.lang.ClassNotFoundException: FileIO
            at com/ms/vm/loader/URLClassLoader.loadClass
            at com/ms/vm/loader/URLClassLoader.loadClass
            at com/ms/applet/AppletPanel.securedClassLoad
            at com/ms/applet/AppletPanel.processSentEvent
            at com/ms/applet/AppletPanel.processSentEvent
            at com/ms/applet/AppletPanel.run
            at java/lang/Thread.run
    This bug can be reproduced always.
    ---------- BEGIN SOURCE ----------
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    public class FileIO extends Applet implements ActionListener {
       public static void main(String[] args) {
          new FileIO();
          F.addWindowListener(new WindowAdapter() {
             public void windowClosing(WindowEvent e) {
                System.exit(0);
       public void init() {
          String tmp=getParameter("Netscape");
          if (tmp!=null) {
             if (tmp.equals("1")) {
                try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalFileAccess");
                   NS=true;
                } catch (Throwable exception) {}
          new FileIO();
          F.setResizable(false);
       public void stop() {
          F.dispose();
       public FileIO() {
          newline=System.getProperty("line.separator");
          F.setLayout(new BorderLayout(0,0));
          String line,inbuf="";
          String newline=System.getProperty("line.separator");
          text=new TextArea(inbuf,24,80,TextArea.SCROLLBARS_BOTH);
          text.setFont(new Font("Courier",Font.PLAIN,12));
          text.setBackground(Color.cyan);
          text.setForeground(Color.black);
          F.add("Center",text);
          Panel pan=new Panel();
          pan.setLayout(new FlowLayout(1,0,0));
          pan.setBackground(Color.yellow);
          TF=new TextField(40);
          TF.setFont(new Font("Courier",Font.PLAIN,12));
          pan.add(TF);
          OP=new Button("Open");
          OP.addActionListener(this);
          pan.add(OP);
          FS=new Button("Save");
          FS.addActionListener(this);
          pan.add(FS);
          SA=new Button("Save-As");
          SA.addActionListener(this);
          pan.add(SA);
          reset=new Button("Reset");
          reset.addActionListener(this);
          pan.add(reset);
          F.add("South",pan);
          F.pack();
          Dimension screen=Toolkit.getDefaultToolkit().getScreenSize();
          Dimension size=F.getSize();
          int X=(screen.width-size.width)/2;
          int Y=(screen.height-size.height)/2;
          F.setLocation(X,Y);
          F.setVisible(true);
       public void actionPerformed(ActionEvent event) {
          String tmp="";
          String O=text.getText();
          StringTokenizer tkn=new StringTokenizer(O,newline);
          int ntkn=tkn.countTokens();
          Object ev=event.getSource();
          if (ev.equals(OP)) {
             FileDialog fd=new FileDialog(F,"File to open",FileDialog.LOAD);
             fd.setFile("*.java");
             fd.show();
             tmp=fd.getDirectory();
             if (fd.getFile()==null) {text.requestFocus(); return;}
             tmp+=fd.getFile();
             TF.setText(tmp);
             try {
                if (NS)
    {netscape.security.PrivilegeManager.enablePrivilege("UniversalFileRead");}
                BufferedReader reader=new BufferedReader(new FileReader(tmp));
                String line;
                String crlf="";
                tmp="";
                while ((line=reader.readLine())!=null) {
                   tmp+=crlf+line;
                   crlf="\n";
                reader.close();
                text.setText(tmp);
             } catch (Throwable e) {
                e.printStackTrace();
          } else if (ev.equals(FS) || ev.equals(SA)) {
             try {
                if (ev.equals(SA)) {
                   FileDialog fd=new FileDialog(F,"File to save",FileDialog.SAVE);
                   fd.setFile("*.java");
                   fd.show();
                   tmp=fd.getDirectory();
                   tmp+=fd.getFile();
                } else {
                   tmp=TF.getText();
                if (tmp.length()==0) {text.requestFocus(); return;}
                if (tmp.indexOf(".java")<0) tmp+=".java";
                TF.setText(tmp);
                if (NS)
    {netscape.security.PrivilegeManager.enablePrivilege("UniversalFileWrite");}
                FileOutputStream fos=new FileOutputStream(tmp);
                BufferedWriter out=new BufferedWriter(new OutputStreamWriter(new
    DataOutputStream(fos)));
                for (int i=0;i<ntkn;i++) out.write(tkn.nextToken()+newline);
                out.flush();
                out.close();
                if (NS)
    {netscape.security.PrivilegeManager.revertPrivilege("UniversalFileWrite");}
                System.out.println(tmp+" saved");
             } catch (Throwable e) {
                e.printStackTrace();
          } else if (ev.equals(reset)) {
             text.setText("");
             TF.setText("");
          text.requestFocus();
       private String replace(String input, String srch, String repl) {
          int i=input.indexOf(srch);
          while (i>=0) {
             input=input.substring(0,i)+repl+input.substring(i+srch.length());
             i=input.indexOf(srch);
          return input;
       private Button OP,FS,SA,reset,TB;
       private boolean newLine,NS=false;
       private TextArea text;
       private TextField TF;
       private final char NL='\n';
       private String content,newline;
       private static Frame F=new Frame("FileIO");
    ---------- END SOURCE ----------
    CUSTOMER WORKAROUND :
    build the signed applet with SDK1.3.1 or make it a signed
    applet that uses Java Plugin 1.4.0 (i.e., sign it with jarsigner).
    workaround :
    suggested_val :
    cust_name : Vira Van.
    dateCreated : 2002-03-24 19:52:18.4
    dateEvaluated : 2002-04-01 18:48:10.858

  • How to invoke BASH shell and execute a command in that shell in Windows 98

    Hello, I have a problem and if somebody will help me, I will be very glad. Thank you.
    I am using BASH shell on Windows 98 OS by means of CYGWIN. And I want to invoke this BASH shell and execute a preprogrammed command in the shell (./scan fileName.txt) from a JAVA program. But so far, I am not sucessful. I can not read or write anything from / to BASH shell. It either blocks and freezes (When I use waitFor( ) ) or appears and disappears without executing scan command (When I do not use waitFor( ) ). My code is like this:
    // This method is used for compiling a file.
    // It invokes BASH shell and executes "./scan fileName.txt" command
    public void compileFileMethod () {
    try {
    Process proc = ( Runtime.getRuntime() ).exec ("C:\\MyDocuments\\CYGWIN.BAT); //I also tried to add -c ./scan fileName.txt after .BAT );
    // I also tried to write "C:\\MyDocuments\\BASH.EXE" but it did not help
    OutputStream ostr = proc.getOutputStream();
    BufferedWriter bw = new BufferedWriter ( new OutputStreamWriter (ostr) );
    InputStream istr = proc.getInputStream();
    BufferedReader br = new BufferedReader ( new InputStreamReader (istr) );
    InputStream errorStr = proc.getErrorStream();
    BufferedReader errorBr = new BufferedReader ( new InputStreamReader (errorStr) );
    bw.write("scan case40.10.txt"); /* I am trying to input the scan command to the shell,but it is not working*/
    bw.flush();
    Vector list = new Vector (1) ;
    String str;
    while ( (str = br.readLine() ) != null) {
    list.addElement(str);
    } // End of while
    Enumeration enumForList = list.elements();
    while ( enumForList.hasMoreElements() ) {
    String tempString;
    tempString = ( String ) enumForList.nextElement();
    System.out.println(tempString); // I am trying to read the outputs of the scan command but it is not reading (I can not see any output)
    I tried with and without waitFor( ), it did not work
    // wait for command to terminate
    proc.waitFor();
    // close streams
    br.close();
    bw.close();
    errorBr.close();
    } // End of try
    catch ( IOException ioe ) {
    JOptionPane.showMessageDialog (null, "Input / output error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of catch
    catch ( SecurityException se ) {
    JOptionPane.showMessageDialog (null, "Security error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    catch ( InterruptedException ie ) {
    JOptionPane.showMessageDialog (null, "Interruption error occured while compiling file ", "Error", JOptionPane.ERROR_MESSAGE);
    } // End of method compileFileMethod
    // Thank you for your helps and time.

    You cannot invoke BAT files directly, you have to invoke the program that run those files which is your Windows 98 shell. For example (under windows 2000), i would invoke "cmd.exe sricpt.bat some args", rather than "script.bar some args".
    Hope this will help you out.

  • How to execute unix command from ODI Procedure

    Hi,
    I am trying to execute below unix command from ODI Procedure (Command on Target tab) but I am getting the error "java.io.IOException: Cannot run program "cd": error=2, No such file or directory" but when I try to execute the same command using OdiOSCommand, it is executing successfully. I don't want to use shell script to execute this command. Is there any specific syntax am I missing to execute this command from ODI procedure?
    cd /project3/tmt/;ls *.dmp > dmplist.lst
    Please help me on this...
    Thanks
    MT

    Hi nahlikh,
    Thank you for the reply.
    I used below command in Procedure but still getting the same error as "java.io.IOException: Cannot run program "OdiOSCommand": error=2, No such file or directory".
    OdiOSCommand "-COMMAND=cd /project3/tmt/;ls *.dmp > dmplist.lst"
    as I mentioned earlier if I use the command cd /project3/tmt/;ls *.dmp > dmplist.lst in OdiOSCommand tool it is executing successfully without any issues.
    any thoughts appreciated to get a solution for this issue.
    Thanks
    MT

  • Executing System Commands In Java

    Hi,
         I am not sure if this is a bug � or I am just doing this wrong. I have
    written a program to move files into ~/.trash/ . My problem is that this
    works only for files without spaces � but for files with spaces it will
    not work. Some of my code is below.
    I have temporarily uploaded the complete file at
    http://www.geocities.com/carmaski/Remove.java
    public static void main(String args[]) {
    String currDir = System.getProperty("user.dir") + "/";
    String trashDir = "\" \"/home/masca/.trash/";
    String commandString = "";
    for (int i = 0; i < args.length; i++ ) {
    File tmpFile = new File(currDir + args);
    if(tmpFile.exists()) {
    commandString = "mv \"" + currDir + args[i] + trashDir
    + args[i] + getTimeTag() + "\"";
    System.out.println("The command would be -- " +
    commandString);
    try {
    Process p = Runtime.getRuntime().exec(commandString);
    catch (IOException e) {
    e.printStackTrace();
    System.exit(-1);
    As an example I tried � this with a file that has a space � and I get
    the following output.
    The command would be -- mv "/home/masca/WORK/Text File"
    "/home/masca/.trash/Text File_2005.04.17_04hrs:25mins:36secs"
    However the file remains without being moved.
    I cannot understand why the mv command does not work in java. If I
    manually copy this to the command line I can get the file to work. It
    should be noted that this program works perfectly if the file does not
    have a space.
    Regards,
    Rio

    Use File.separator or simply / instead of Windows
    backslashes.
    - SaishI think OP is on a unix machine, and he still needs to escape the spaces. The escape character is, of course, a back-slash.
    Depending on the shell (my experience is with bash), to execute the command mv Test File.txt newTest File.txt, the file names either need to be double-quoted so that the command shell will treat them as a single token (I think that will work), or the spaces need to be escaped (I know that will work). In java, to include a single \ in a literal String, you need to escape the escape character, which is why I think two \\ are needed in the String, so that one will survive to be passed on to the exec command.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Execute linux command from java

    I wanna execute linux command from java, bu the output has error:
    Return code = 1
    top: failed tty get
    The code as:
    import java.io.*;
    public class Execute {
         public static void main(String[] args) {
              try {
                   final Process process = Runtime.getRuntime().exec("top");
                   new Thread() {
                        public void run() {
                             try {
                                  InputStream is = process.getInputStream();
                                  byte[] buffer = new byte[1024];
                                  for (int count = 0; (count = is.read(buffer)) >= 0;) {
                                       System.out.write(buffer, 0, count);
                             } catch (Exception e) {
                                  e.printStackTrace();
                   }.start();
                   new Thread() {
                        public void run() {
                             try {
                                  InputStream is = process.getErrorStream();
                                  byte[] buffer = new byte[1024];
                                  for (int count = 0; (count = is.read(buffer)) >= 0;) {
                                       System.err.write(buffer, 0, count);
                             } catch (Exception e) {
                                  e.printStackTrace();
                   }.start();
                   int returnCode = process.waitFor();
                   System.out.println("Return code = " + returnCode);
              } catch (Exception e) {
                   e.printStackTrace();
    }Help please.

    Your code is probably good to run a program, that does not use terminal capabilities.
    Program "top" is a little bit more complicated - you have to run it with a real terminal.
    Try to run "xterm -e top". You can find an example how to run an external program
    from java code in cnd/gdb module on http://cnd.netbeans.org
    For example, take a look at openExternalProgramIOWindow() method on this page:
    http://cnd.netbeans.org/source/browse/cnd/gdb/src/org/netbeans/modules/cnd/debugger/gdb/proxy/Attic/GdbProxyCL.java?rev=1.1.2.6.2.5&only_with_tag=release551_fixes&view=markup
    It runs a command with external terminal.
    Thanks,
    Nik

  • Execute unix commands from Java

    Hi,
    I have a client application running on windows. This client should connect to a unix server and check for the existence of a file and display the result as "File found/File not found". In order to connect from windows to the unix server, I used the sockets and the connection is successfully established. The second part is to check for the presence of the file in unix server. I searched in google.com and the option I found to execute a unix command from java is the "Runtime.exec()". Runtime.exec is considered as the less effective (not a favorable) one.
    Is there any other option available (other than the Runtime) to execute the unix command from java? Can you please let me know.
    Thanks a lot
    Aishu

    So, please let me know how I can execute the above unix commands without Runtime.exec()You have a client and a server.
    You want something to run on the server, not the client.
    That means that something must in fact being running on the server before the client does anything at all.
    For example telnet. Or a J2EE server application.
    So is something like that running?
    If not then there absolutely no way to do what you want, even with Runtime.exec().
    If yes then what you do depends on what is running. So Runtime.exec() would be pointless if a J2EE server was running.

  • How to execute Dos Command 'Pause' from Java ?

    How to execute Dos Command 'Pause' from Java ?
    I have read the article in javaworld for Runtime.exec() anomalies.
    Can someone please give an insight on this?

    Thanks Buddy!
    That was very useful. Even though its a simple
    solution, I never thought about that.Bullshit! Reread reply #7 of http://forum.java.sun.com/thread.jspa?threadID=780193

Maybe you are looking for